I applied this style to the grid
<UserControl.Resources> <local:GridTestViewModel x:Key="ViewModel" /> <Style x:Key="AltRowStyle" TargetType="infra:CellControl"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="infra:CellControl"> <Grid> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="CommonStates"> <VisualState x:Name="Normal" /> <VisualState x:Name="MouseOver" /> <VisualState x:Name="Alternate"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="AltElem" Storyboard.TargetProperty="(UIElement.Visibility)"> <DiscreteObjectKeyFrame KeyTime="00:00:00"> <DiscreteObjectKeyFrame.Value> <Visibility>Visible </Visibility> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="AltElementHightlight" Storyboard.TargetProperty="(UIElement.Visibility)"> <DiscreteObjectKeyFrame KeyTime="00:00:00"> <DiscreteObjectKeyFrame.Value> <Visibility>Visible </Visibility> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" x:Name="Root" /> <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Visibility="Collapsed" x:Name="AltElem"> <Border.Background> <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> <LinearGradientBrush.GradientStops> <GradientStopCollection> <GradientStop Offset="0" Color="#FF77dafc" /> <GradientStop Offset="0.983" Color="#FF5bd4fd" /> </GradientStopCollection> </LinearGradientBrush.GradientStops> </LinearGradientBrush> </Border.Background> </Border> <Rectangle Fill="#7FFFFFFF" x:Name="AltElementHightlight" Visibility="Collapsed" Margin="0,1,0,0" Height="1" VerticalAlignment="Top" /> <ContentPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" /> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> </UserControl.Resources>
and it hides the "rectangle" in the selected cell/row ...
and all of this features
<SolidColorBrush x:Key="CellItemNormalBackgroundBrush" Color="#FFFFFFFF"/> <SolidColorBrush x:Key="CellItemNormalBorderBrush" Color="#FFC9CACA"/> <SolidColorBrush x:Key="CellItemSelectedBorderBrush" Color="#FF6DC5D1"/> <SolidColorBrush x:Key="CellRowHoverBackgroundBrush" Color="#FFD3E8FB"/> <SolidColorBrush x:Key="CellItemAltNormalBackgroundBrush" Color="#FF90B9E4"/> <SolidColorBrush x:Key="CellItemSelectedBackgroundBrush" Color="#FFD5EAF2"/>
how can I show those and the alternate row style in one style?
Hi,
So, i'm a little confused. What are you trying to accomplish with this style?
Are you just trying to change the background color of the AlternateRow?
It looks to me like you stripped out most of the VisualStates and elements that make up a cell.
Check out the following Help article that demonstrates how to use Blend to create a copy of the origional style:
http://help.infragistics.com/NetAdvantage/Silverlight/2010.1/CLR3.5/?page=SL_DesignersGuide_Editing_Style_Properties_Using_Expression_Blend.html
Or you can take a look at the original style from your install directory here:
http://help.infragistics.com/NetAdvantage/Silverlight/2010.1/CLR3.5/?page=SL_DesignersGuide_Location_of_Generic_xaml_File.html
Hope this helps,
-SteveZ
Yes, I only want to change the background color of the AlternateRow.
I originally used the default style using Edit Template>Edit a Copy from Blend. But the default style was not giving me the alternate row styles so I used the Infragistics samples of the XamWebGrid > AlternateRow Styling and it blocked everything up (that is the code I pasted above). So I am confused about how to accomplish the alternate row without blocking stuff.
I don’t know how the default style should look but when I change these (in the default style)
<SolidColorBrush x:Key="CellItemNormalBackgroundBrush" Color="#FFFFFFFF"/><SolidColorBrush x:Key="CellItemNormalBorderBrush" Color="#FFC9CACA"/><SolidColorBrush x:Key="CellItemSelectedBorderBrush" Color="#FF6DC5D1"/><SolidColorBrush x:Key="CellRowHoverBackgroundBrush" Color="#FFD3E8FB"/><SolidColorBrush x:Key="CellItemAltNormalBackgroundBrush" Color="#FF90B9E4"/><SolidColorBrush x:Key="CellItemSelectedBackgroundBrush" Color="#FFD5EAF2"/>
Only the first cell gets the alternate row style, not the row and none of the other rows.
Why is this happening?