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
1585
XamGrid Style
posted

I have the following Style for my XamGrid.

The only thing I can't figure out is the last row in the grid does not have a horizontal border on the bottom side, refer to image. Any ideas where I went wrong?

 

 

Here is the code:

<Style x:Key="GridCellStyle" TargetType="ig:CellControl">
 <Setter Property="Template">
  <Setter.Value>
   <ControlTemplate TargetType="ig:CellControl">
    <Grid>
     <vsm:VisualStateManager.VisualStateGroups>
      <vsm:VisualStateGroup x:Name="CommonStates">
       <vsm:VisualState x:Name="Normal">
        <Storyboard>
         <ObjectAnimationUsingKeyFrames
           Storyboard.TargetName="GridCellNormalFill"
           Storyboard.TargetProperty="(UIElement.Visibility)">
          <DiscreteObjectKeyFrame KeyTime="00:00:00">
           <DiscreteObjectKeyFrame.Value>
            <Visibility>Visible</Visibility>
           </DiscreteObjectKeyFrame.Value>
          </DiscreteObjectKeyFrame>
         </ObjectAnimationUsingKeyFrames>
         <ObjectAnimationUsingKeyFrames
           Storyboard.TargetName="GridCellNormalBorder"
           Storyboard.TargetProperty="(UIElement.Visibility)">
          <DiscreteObjectKeyFrame KeyTime="00:00:00">
           <DiscreteObjectKeyFrame.Value>
            <Visibility>Visible</Visibility>
           </DiscreteObjectKeyFrame.Value>
          </DiscreteObjectKeyFrame>
         </ObjectAnimationUsingKeyFrames>
        </Storyboard>
       </vsm:VisualState>
       <vsm:VisualState x:Name="MouseOver">
        <Storyboard>
         <ObjectAnimationUsingKeyFrames
           Storyboard.TargetName="GridCellMouseOverFill"
           Storyboard.TargetProperty="(UIElement.Visibility)">
          <DiscreteObjectKeyFrame KeyTime="00:00:00">
           <DiscreteObjectKeyFrame.Value>
            <Visibility>Visible</Visibility>
           </DiscreteObjectKeyFrame.Value>
          </DiscreteObjectKeyFrame>
         </ObjectAnimationUsingKeyFrames>
         <ObjectAnimationUsingKeyFrames
           Storyboard.TargetName="GridCellMouseOverBorder"
           Storyboard.TargetProperty="(UIElement.Visibility)">
          <DiscreteObjectKeyFrame KeyTime="00:00:00">
           <DiscreteObjectKeyFrame.Value>
            <Visibility>Visible</Visibility>
           </DiscreteObjectKeyFrame.Value>
          </DiscreteObjectKeyFrame>
         </ObjectAnimationUsingKeyFrames>
        </Storyboard>
       </vsm:VisualState>
       <vsm:VisualState x:Name="Alternate">
        <Storyboard>
         <ObjectAnimationUsingKeyFrames Storyboard.TargetName="GridCellAlternateFill" Storyboard.TargetProperty="(UIElement.Visibility)">
          <DiscreteObjectKeyFrame KeyTime="00:00:00">
           <DiscreteObjectKeyFrame.Value>
            <Visibility>Visible</Visibility>
           </DiscreteObjectKeyFrame.Value>
          </DiscreteObjectKeyFrame>
         </ObjectAnimationUsingKeyFrames>
         <ObjectAnimationUsingKeyFrames Storyboard.TargetName="GridCellAlternateBorder" Storyboard.TargetProperty="(UIElement.Visibility)">
          <DiscreteObjectKeyFrame KeyTime="00:00:00">
           <DiscreteObjectKeyFrame.Value>
            <Visibility>Visible</Visibility>
           </DiscreteObjectKeyFrame.Value>
          </DiscreteObjectKeyFrame>
         </ObjectAnimationUsingKeyFrames>
        </Storyboard>
       </vsm:VisualState>
      </vsm:VisualStateGroup>
      <vsm:VisualStateGroup x:Name="SelectedStates">
       <VisualState x:Name="NotSelected"/>
       <VisualState x:Name="Selected">
        <Storyboard>
         <ObjectAnimationUsingKeyFrames
          Storyboard.TargetName="GridCellSelectedFill"
          Storyboard.TargetProperty="(UIElement.Visibility)">
          <DiscreteObjectKeyFrame KeyTime="00:00:00">
           <DiscreteObjectKeyFrame.Value>
            <Visibility>Visible</Visibility>
           </DiscreteObjectKeyFrame.Value>
          </DiscreteObjectKeyFrame>
         </ObjectAnimationUsingKeyFrames>
         <ObjectAnimationUsingKeyFrames
           Storyboard.TargetName="GridCellSelectedBorder"
           Storyboard.TargetProperty="(UIElement.Visibility)">
          <DiscreteObjectKeyFrame KeyTime="00:00:00">
           <DiscreteObjectKeyFrame.Value>
            <Visibility>Visible</Visibility>
           </DiscreteObjectKeyFrame.Value>
          </DiscreteObjectKeyFrame>
         </ObjectAnimationUsingKeyFrames>
        </Storyboard>
       </VisualState>
      </vsm:VisualStateGroup>
     </vsm:VisualStateManager.VisualStateGroups>
     <Border x:Name="Root"
      BorderBrush="{TemplateBinding BorderBrush}" 
      BorderThickness="{TemplateBinding BorderThickness}" 
      Background="{TemplateBinding Background}"/>
     <Border x:Name="GridCellAlternateFill" 
      BorderBrush="{TemplateBinding BorderBrush}" 
      BorderThickness="{TemplateBinding BorderThickness}" 
      Visibility="Collapsed">
      <Border.Background>
       <SolidColorBrush Color="#FFE2E2E2"/>
      </Border.Background>
     </Border>
     <Rectangle x:Name="GridCellAlternateBorder"
      Fill="#FFCBCBCB" 
      Visibility="Collapsed" 
      Margin="0,0,0,0" 
      Height="1" 
      VerticalAlignment="Top" />
     <Border x:Name="GridCellNormalFill"     
      BorderBrush="{TemplateBinding BorderBrush}" 
      BorderThickness="{TemplateBinding BorderThickness}" 
      Visibility="Collapsed">
      <Border.Background>
       <SolidColorBrush Color="#FFFFFFFF"/>
      </Border.Background>
     </Border>
     <Rectangle x:Name="GridCellNormalBorder" 
      Fill="#FFFFFFFF" 
      Visibility="Collapsed" 
      Margin="1,0,1,0" 
      Height="1" 
      VerticalAlignment="Top" />
     <Border x:Name="GridCellMouseOverFill"
      BorderBrush="{TemplateBinding BorderBrush}" 
      BorderThickness="{TemplateBinding BorderThickness}" 
      Visibility="Collapsed">
      <Border.Background>
       <SolidColorBrush Color="#FFFFFFCE"/>
      </Border.Background>
     </Border>
     <Rectangle x:Name="GridCellSelectedBorder" 
      Fill="#FFB6D9E2" 
      Visibility="Collapsed" 
      Margin="0,0,1,0" 
      Height="1" 
      VerticalAlignment="Top" />

     <Border x:Name="GridCellSelectedFill"
      BorderBrush="{TemplateBinding BorderBrush}" 
      BorderThickness="{TemplateBinding BorderThickness}" 
      Visibility="Collapsed">
      <Border.Background>
       <SolidColorBrush Color="#FFB1C5DE"/>
      </Border.Background>
     </Border>
     <Rectangle x:Name="GridCellMouseOverBorder" 
      Fill="#FFE5E54F" 
      Visibility="Collapsed" 
      Margin="0,0,1,0" 
      Height="1" 
      VerticalAlignment="Top" />

     <ContentPresenter
       VerticalAlignment="{TemplateBinding VerticalContentAlignment}" 
       HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
       Margin="{TemplateBinding Padding}" />
    </Grid>
   </ControlTemplate>
  </Setter.Value>
 </Setter>
</Style>