To illustrate this concept, we will customize a button control. To achieve all that is template, your best friend is undoubtedly the MSDN. Indeed you will find on the latter on behalf of various states (MouseOver for example a button), and examples. We'll start with the visual of our button. Our root element will be named RootElement.
Code:
< Grid x : Name = " RootElement " > < / Grid >
Now we'll put a little color, namely a blue border and a blue gradient background.
Code:
< Grid x : Name = " RootElement " >
< Border x : Name = " VisualElement " Width = " {TemplateBinding Width} " Height = " {TemplateBinding Height} " CornerRadius = " 4 " BorderThickness = " 1 " >
< Border.BorderBrush >
< SolidColorBrush Color = " #FF9BB7E0 " / > < / Border.BorderBrush > < Border.Background >
< LinearGradientBrush EndPoint = " 0.5,1 " StartPoint = " 0.5,0 " > < GradientStop x : Name = " Color1 " Color = " #FFC8DBEE " Offset = " 0.260 " / > < GradientStop x : Name = " Color2 " Color = " #FF84AFE6 " Offset = " 0.530 " / >
< GradientStop x : Name = " Color3 " Color = " #FFC8DBEE " Offset = " 0.80 " / > < / LinearGradientBrush >
< / Border . Background > < / Border > < / Grid >
Here is the result of our button with this code for now
Code:
< Button Width = " 155 " Height = " 50 " Content = " Bouton Style Word 2007 "
Style = " {StaticResource ButtonRectangle} "
VerticalAlignment = " Center "
FontFamily = " Verdana " FontSize = " 12 " / >
Bookmarks