Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
255
XamWeb grid alternate row style
posted

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?

Parents
No Data
Reply Children