1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
|
<!--fichier generic.xaml-->
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfMyControlLib">
<!--style par defaut pour le CustomButton-->
<Style
TargetType="{x:Type local:CustomButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate
TargetType="{x:Type local:CustomButton}">
<Grid Margin="5" Name="grid">
<Ellipse Stroke="DarkBlue"
StrokeThickness="2">
<Ellipse.Fill>
<RadialGradientBrush
Center="0.3,0.2"
RadiusX="0.5"
RadiusY="0.5">
<GradientStop
Color="Azure" Offset="0.1" />
<GradientStop
Color="CornflowerBlue" Offset="1.1" />
</RadialGradientBrush>
</Ellipse.Fill>
</Ellipse>
<ContentPresenter
Name="content"
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--les MergedDictionaries-->
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/WpfMyControlLib;component/Themes/BrushStyleRed.xaml" />
<ResourceDictionary Source="/WpfMyControlLib;component/Themes/BrushStyleCornsilk.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
<!--Fichier BrushStyleCornsilk.xaml-->
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfMyControlLib">
<!--simple x:jey pour le style N0 1-->
<Style
x:Key="StyleBrushCornsilk"
TargetType="{x:Type local:CustomButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate
TargetType="{x:Type local:CustomButton}">
<Grid
Margin="5"
Name="grid">
<Ellipse
x:Name="MyEllipse"
Stroke="Brown"
StrokeThickness="4"
Fill="Cornsilk">
</Ellipse>
<ContentPresenter
Name="content" Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger
Property="IsMouseOver" Value="true">
<Setter
Property="Ellipse.Opacity" Value="0.4"/>
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>
<!--Fichier BrushStyleRed.xaml-->
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfMyControlLib">
<!--simple x:jey pour le style N0 2-->
<Style
x:Key="StyleBrushRed"
TargetType="{x:Type local:CustomButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate
TargetType="{x:Type local:CustomButton}">
<Grid
Margin="5"
Name="grid">
<Ellipse
x:Name="MyEllipse"
Stroke="CornflowerBlue"
StrokeThickness="4"
Fill="Red">
</Ellipse>
<ContentPresenter
Name="content" Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger
Property="IsMouseOver" Value="true">
<Setter
Property="Ellipse.Opacity" Value="0.4"/>
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary> |
Partager