HI,
I'm really trying ot figure out this Wpf styling. I have the following style, which is a port from a Silverlight theme.
<Style TargetType="igEditors:XamNumericEditor"> <Setter Property="BorderThickness" Value="1"/> <Setter Property="Background" Value="{StaticResource ShadeBrush}"/> <Setter Property="Foreground" Value="#FF000000"/> <Setter Property="Padding" Value="2"/> <Setter Property="BorderBrush" Value="{StaticResource NormalBorderBrush}" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="igEditors:XamNumericEditor"> <Grid > <vsm:VisualStateManager.VisualStateGroups> <vsm:VisualStateGroup x:Name="CommonStates"> <vsm:VisualStateGroup.Transitions> <vsm:VisualTransition GeneratedDuration="00:00:00.1" To="MouseOver"/> <vsm:VisualTransition GeneratedDuration="00:00:00.1" To="ReadOnly"/> <vsm:VisualTransition GeneratedDuration="00:00:00.1" To="Disabled"/> <vsm:VisualTransition From="Normal" GeneratedDuration="00:00:00.3000000" To="MouseOver"/> <vsm:VisualTransition From="MouseOver" GeneratedDuration="00:00:00.5000000" To="Normal"/> </vsm:VisualStateGroup.Transitions> <vsm:VisualState x:Name="Normal"/> <vsm:VisualState x:Name="MouseOver"> <Storyboard> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="HoverBorder" Storyboard.TargetProperty="(UIElement.Opacity)"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </vsm:VisualState> <vsm:VisualState x:Name="Disabled"> <Storyboard> <DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="Opacity"> <SplineDoubleKeyFrame KeyTime="0" Value="0.6"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </vsm:VisualState> <vsm:VisualState x:Name="ReadOnly"> <Storyboard> <DoubleAnimationUsingKeyFrames Storyboard.TargetName="ReadOnlyVisualElement" Storyboard.TargetProperty="Opacity"> <SplineDoubleKeyFrame KeyTime="0" Value="1"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </vsm:VisualState> </vsm:VisualStateGroup> </vsm:VisualStateManager.VisualStateGroups> <Border x:Name="Border" Opacity="1" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2,2,2,2" > <Grid> <Border x:Name="ReadOnlyVisualElement" Opacity="0" Background="#72F7F7F7"/> <Border BorderThickness="1" CornerRadius="1,1,1,1"> <Border.BorderBrush> <SolidColorBrush Color="Transparent" x:Name="MouseOverColor"/> </Border.BorderBrush> <ScrollViewer BorderThickness="0" IsTabStop="False" Padding="{TemplateBinding Padding}" x:Name="PART_ContentHost"/> </Border> </Grid> </Border> <Border x:Name="HoverBorder" Opacity="0" BorderBrush="{StaticResource NormalBrush}" BorderThickness="2,2,2,2" CornerRadius="2,2,2,2" /> <Border x:Name="DisabledVisualElement" IsHitTestVisible="False" Opacity="0" Background="#FFFFFFFF" BorderBrush="#A5F7F7F7" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2,2,2,2" /> <Border Margin="1" x:Name="FocusVisualElement" IsHitTestVisible="False" Opacity="0" BorderBrush="{StaticResource NormalBrush}" BorderThickness="2.1,2.1,2.1,2.1" CornerRadius="0.2,0.2,0.2,0.2" /> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style>
When I apply it, the XamNumericEditor now has Up / Down buttons (which look nice, but I don't want them there!)
Where am I going wrong?
Hello,
Please read this article about VisualStateManager and WPF and I am sure it would be helpful for you.
http://blogs.msdn.com/johngossman/archive/2008/08/08/visualstatemanager-for-desktop-wpf.aspx
Hi,
I read the article, but I'm not sure what I'm supposed to be getting out of it. VSM is now part of the WPFToolkit, so plenty of people are using it (and the DataGrid), and the Toolkit sounds like it's going to find it's way into mainstream Wpf in the very near future.
So is there something else that's supposed to help in there?