<DataGrid Name="dataGrid1" CanUserAddRows="False">
This blog is not specific to a technology. I always prefer to share. That is why as I will learn something new. I will try to post that here. Happy Sharing...
Showing posts with label WPF. Show all posts
Showing posts with label WPF. Show all posts
Friday, November 16, 2012
How to remove a blank row at the end of WPF datagrid
WPF - Inheriting a style
In the following style, a TextBlock's style in created with blinking animation.
// Here is the base style for TextBlock
<Style x:Key="CellBaseStyle" TargetType="{x:Type TextBlock}"> <Setter Property="Background" Value="Transparent"/> <Setter Property="Padding" Value="0,50,0,0"></Setter> </Style>
// Here you will use BasedOn property of Style to use the base style for TextBlock, properties in base style can be overridden in this style as well just like background property
<Style TargetType="{x:Type TextBlock}" x:Key="SelectedCellStyle"
BasedOn="{StaticResource CellBaseStyle}">
<Setter Property="Background"> <Setter.Value> <SolidColorBrush> <SolidColorBrush.Color> <Color R="0" G="168" B="0"/> </SolidColorBrush.Color> </SolidColorBrush> </Setter.Value> </Setter> <Setter Property="Foreground" Value="White"/> <Style.Triggers> <EventTrigger RoutedEvent="Binding.TargetUpdated"> <BeginStoryboard HandoffBehavior="Compose"> <Storyboard TargetProperty="(TextBlock.Background).(SolidColorBrush.Color)"> <ColorAnimation Duration="0:0:0.7" To="DarkGreen" AutoReverse="True" RepeatBehavior="1" /> </Storyboard> </BeginStoryboard> </EventTrigger> </Style.Triggers> </Style>
Labels:
Animation in Style,
Style,
Style Inheritance in WPF,
WPF
Subscribe to:
Posts (Atom)