Thursday, July 5, 2012

How to Create a Custom Stroke in Expression Design

 

1) First, draw whatever you want to be used as a stroke. In this case, I will drew an ant.

image

2) Select the paths with the selection tool and go to Object > Stroke > New Stroke Definition

image

This will open up a new tab that look something like this

image

3) Select everything with the selection tool and right click. You should see this:

image

This gives you the option to anchor the image and make repeating. In my case, I want the ants to repeat, so I select that.

4) File >  Save

image

Give your stroke an appropriate name.

That’s it. Now you should be able to use your stroke in your designs.

image

With this new stroke, I can now make a line of ants following whatever path I want.

image

I hope this helps! Have fun!

Thursday, February 2, 2012

Expression Blend Bug–Can’t Open UserControl

Ever seen this when trying to work in Blend?

(Element Name) is not supported in a windows presentation foundation (WPF) project.

or this?

(UserControl) is not supported in a windows presentation foundation (WPF) project.

Well, I ran into this and had a tough time figuring out what was going on. There are a lot of forum posts out there talking about the topic, but no real solution that I have found. I kept on trying different things and was able to overcome it. Here is what I did to fix it.

I went to the solution explorer in visual studio and right clicked on the project file for the project that was having the problems. I selected ‘Edit Project File’. This unloads the project from the current solution and opens the project file in the xml editor.

Towards the top of the file you should see something like this

image

After my offending project file with other functioning project files, I noticed that my platform was set to x86 rather than AnyCPU like my other projects. I changed it to AnyCPU, saved, reloaded the project, built the solution and then tried to open the UserControl in Blend. This fixed the problem!

If you are having this same issue, I’d give that a shot. Good luck!

Wednesday, January 18, 2012

How to be a Computer Expert!

 

This one is all over the web. Just thought I’d post it here in case you haven’t see it. It sums it up pretty well.

computer flow chart

Wednesday, January 11, 2012

How to Change the Font Size of a WPF Tab Control’s Header

To change the font size of the tab header of a wpf tab control you have to redefine the ItemTemplate property of the Tab Control.

This is a question I have heard a lot, so I decided to blog about it for those of you needing to do the same thing. Here is a code sample.

<DataTemplate x:Key=”temp”>

<TextBlock Text=”{Binding}” FontSize=”20”/>

</DataTemplate>

 

<TabControl …. ItemTemplate=”{DynamicResource temp}”/>

 

That’s all there is to it.

Happy Coding!

Wednesday, December 14, 2011

Reboot from the Command Line

I often use a remote desktop connection to work on my desktop from my laptop. This is very handy, but there are some limitations. One such limitation is the lack of ability to reboot the machine you are remoting into. The option is not available within the start menu when you are remoting. There are some instances, though, when you really need to reboot. If you find yourself in this situation, you can reboot via the command line. Here is the command to do it.

shutdown /r /t 01

Happy Remoting!

Monday, November 28, 2011

How to Create a Simple Splash Screen in WPF

I have posted on this topic before, but I thought I would re-post with a step by step tutorial for those who are very new to wpf. Sorry to those of you who are more veterans. I will post more advanced topics soon, but this one’s for the newbies.

Here goes…

WPF makes creating a splash screen fairly simple. All you need to do is embed an image file into your project and change the Build Action on it.

Here is a step-by-step tutorial on how to do this.

Step 1) Create your application.
Here is the xaml for my very complicated application:

image

Step 2) Add an image file to your application. PNG files with transparent backgrounds are supported and are often a good choice for splash screens. Here is the image I created in Photoshop… nice huh?

image

Step 3) Right click on the image file in the solution explorer and click on Properties

image

Step 4) Set the Build Action to SplashScreen in the Properties panel

image

Step 5) Build and run the application.

 

You should now see your image splash before the application is loaded. I managed to get a screenshot as the splash screen was fading out and my application was starting to fade in.

image

That’s all there is to it. It is very simple. There are other ways to show and hide your splashcreen in code, but I won’t get into that in this post. I just wanted to keep it simple for those of you new to SplashScreens in wpf. Happy Splash Screening!

Friday, October 7, 2011

Wpf and the invisible checkbox (and radio button)

Just ran into another strange wpf bug. This one involves checkboxes and radiobuttons. I was working on a login screen that has a couple of checkboxes for remembering the username and password. The code looked like this…

<StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
     <
CheckBox Content="Username" Foreground="White"/>
     <CheckBox Content="Password" Foreground="White"/>
</StackPanel>

These checboxes were on a dark colored panel, so the white text showed up nicely. Running the app on my Windows 7 box worked fine, but when I ran the app on a Windows XP box, you could not see the check mark inside the box when the user clicked on it. The control still worked, but the check was just invisible. Actually, it wasn’t invisible, it was just a white checkmark on a white box (aka… invisible). This is a wpf/windows xp/checkbox bug. In Windows XP, when the foreground color is changed, the checkmark picks up that color change… why? you ask?… I don’t know. But, here is a workaround for this situation. Simply put labels with the white foreground as the content for your checkboxes. Now the foreground color of the checkbox is still the default (black) color and the checkmark will be visible for those running the app in Windows XP. Here is the modified code.

<StackPanel HorizontalAlignment="Left"  Orientation="Horizontal">
<
CheckBox>
<
Label Content="Username" Foreground="White"/>
</
CheckBox>
<CheckBox>
<Label Content="Password" Foreground="White"/>
</CheckBox>
</StackPanel>



I have also seen this issue with radiobuttons. Use the same workaround for that and you should be good to go.



I hope this helps. If it does, feel free to leave a comment. Thanks!