Answered by:
Changing the font..

Question
-
Hi,
I am very new to WPF applications and I am trying to do a small application using WPF.
I have a button and label controls in my form and I want to chage the font style of those. It is not like the normal windows forms to change the font.
How can I change the font at design time.
Thanks,Monday, May 18, 2009 3:04 AM
Answers
-
Thnx for all of your help
- Marked as answer by bbby A programmer Monday, May 18, 2009 6:18 AM
Monday, May 18, 2009 6:18 AM
All replies
-
Here's a link to a thread that has already answered your question:
http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/ad69959c-d611-49cc-abe4-a7405462dbb6/
DougMonday, May 18, 2009 3:20 AM -
Is it a normal WPF application or Silverlight.
In the first you have more possibilities in design time, in the way it was and in the XAML file (The only point is you can type in more, it is not a drop down like with non WPF).
For Silverlight you can do it only in the XAML File
Cor- Proposed as answer by Cor Ligthert Monday, May 18, 2009 8:27 AM
Monday, May 18, 2009 3:51 AM -
Thnkx for you reply.
It is a normal WPF application.Monday, May 18, 2009 3:57 AM -
I am feeling a bit difficult designing in WPF application rather than non-WPF applications. Is that really difficult or? Any steps to follow to design WPF applications?
Monday, May 18, 2009 3:59 AM -
Do you even try Doug help and design ur code to change font? I just use and figure out in 5 minute for myself. Now I do myself I do not forget. Try for do, it work good.
O
m
a
rMonday, May 18, 2009 4:12 AM -
It is better to ask in the WPF forum but you can change the font in the xaml markup
<
Button Grid.Row="1" Height="auto" Margin="53,64,92,0" Name="Button1" VerticalAlignment="Top" Padding="10" FontFamily="Black Chancery">Button</Button>
Coding for fun Be a good forum member mark posts that contain the answers to your questions or those that are helpfulMonday, May 18, 2009 4:39 AM -
Have a look at this site as well
http://www.wiredprairie.us/journal/2006/09/wpf_decorators_build_your_own.html
The button uses a special class called Button chrome , to create a custom button you have to create a control template for it . WPF uses what is know as lookless controls . You can design the look of the control , add other controls to it and the function is handled by the controls class . A button is a content control it only allows one content item but that item can be something like a stackpanel that can contain any number of items such as images or textblocks .
<Button Grid.Row=" 1" Width="100" HorizontalAlignment="right" VerticalAlignment="bottom" Margin="10,10,10,10" Click="Click" x:Name="SPanel">
<StackPanel >
<Image Source="fish.jpg"></Image>
<TextBlock HorizontalAlignment="Center">Click Me</TextBlock>
</StackPanel>
</Button>
Coding for fun Be a good forum member mark posts that contain the answers to your questions or those that are helpful- Edited by bdbodger Monday, May 18, 2009 5:11 AM
Monday, May 18, 2009 4:52 AM -
The above post is without using a control template but when you click it you still get the normal button background . I have a book on WPF but I am less than half way through it .
Coding for fun Be a good forum member mark posts that contain the answers to your questions or those that are helpfulMonday, May 18, 2009 5:03 AM -
Thnx for all of your help
- Marked as answer by bbby A programmer Monday, May 18, 2009 6:18 AM
Monday, May 18, 2009 6:18 AM -
-
I agree maybe he needs to learn how to use this forum . Not a great way to get ppl to give you help by not giving them credit for thier efforts .
Coding for fun Be a good forum member mark posts that contain the answers to your questions or those that are helpfulMonday, May 18, 2009 7:41 PM -
bbby A programmer , Doug correct ! you need give Answer credit to bdbodger bcoz he give you the answer ! U do thing like this and no ppl will want help u if u take credit for THEIR work !
O
m
a
rWednesday, May 20, 2009 12:49 AM -
How about a better example and a picture
<Button Grid.Row=" 1" Width="100" HorizontalAlignment="right" VerticalAlignment="bottom" Margin="10,10,10,10" Click="Click" x:Name="SPanel" FontFamily=" Times New Roman" FontSize=" 20" FontStyle="Italic" FontWeight="Bold" Padding=" 5" > <StackPanel > <Image Source="fish.jpg"></Image> <TextBlock HorizontalAlignment="Center" TextDecorations="Underline" TextBlock.Foreground=" red" >Click Me</TextBlock> </StackPanel> </Button>
_____________________________________________________________________________________________________________________________
Coding for fun Be a good forum member mark posts that contain the answers to your questions or those that are helpful- Edited by bdbodger Wednesday, May 20, 2009 3:03 AM
Wednesday, May 20, 2009 2:48 AM -
@ bdbodger,
It's really a slap in the face when people don't give the person(s) the credit for providing the answer. Must be wanting points in this case, and doesn't know that more than one response can be marked as the answer. Another thing is the people that mark their own posts as a proposed answer....borderline conceit IMO.
Ah well, life goes on.........
DougWednesday, May 20, 2009 2:52 AM