How do I remove the GridViewCell bottom border when a grouping is selected? I set the default GridViewCell to have a bottom border. When a user selects a grouping I want to remove that border. I tried to add an ExpandedStateGroup to the VisualStateManager of GridViewCellTemplate and remove the border but it didn't work:
<
ControlTemplate
x:Key
=
"GridViewCellTemplate"
TargetType
=
"grid:GridViewCell"
>
<
Grid
>
<
VisualStateManager.VisualStateGroups
>
<
VisualStateGroup
x:Name
=
"SelectionStates"
>
<
VisualState
x:Name
=
"Unselected"
/>
<
VisualState
x:Name
=
"Selected"
/>
</
VisualStateGroup
>
<
VisualStateGroup
x:Name
=
"CommonStates"
>
<
VisualState
x:Name
=
"Normal"
/>
<
VisualState
x:Name
=
"MouseOver"
>
<
Storyboard
>
<
ObjectAnimationUsingKeyFrames
Storyboard.TargetName
=
"Background_Over"
Storyboard.TargetProperty
=
"Visibility"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Visibility
>Visible</
Visibility
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
</
VisualStateGroup
>
<
VisualStateGroup
x:Name
=
"EditingStates"
>
<
VisualState
x:Name
=
"Edited"
>
<
Storyboard
>
<
ObjectAnimationUsingKeyFrames
Storyboard.TargetName
=
"PART_ContentPresenter"
Storyboard.TargetProperty
=
"Margin"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Thickness
>0</
Thickness
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
<
ObjectAnimationUsingKeyFrames
Storyboard.TargetName
=
"PART_ContentPresenter"
Storyboard.TargetProperty
=
"VerticalAlignment"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
VerticalAlignment
>Stretch</
VerticalAlignment
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
<
ObjectAnimationUsingKeyFrames
Storyboard.TargetName
=
"PART_CellBorder"
Storyboard.TargetProperty
=
"Background"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0:0:0"
Value
=
"{telerik:Windows8Resource ResourceKey=MainBrush}"
/>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
<
VisualState
x:Name
=
"Display"
/>
</
VisualStateGroup
>
<
VisualStateGroup
x:Name
=
"DisabledStates"
>
<
VisualState
x:Name
=
"Enabled"
/>
<
VisualState
x:Name
=
"Disabled"
>
<
Storyboard
>
<
DoubleAnimationUsingKeyFrames
Storyboard.TargetName
=
"PART_ContentPresenter"
Storyboard.TargetProperty
=
"Opacity"
>
<
DiscreteDoubleKeyFrame
KeyTime
=
"0:0:0"
Value
=
"0.3"
/>
</
DoubleAnimationUsingKeyFrames
>
<
ObjectAnimationUsingKeyFrames
Storyboard.TargetName
=
"Background_Disabled"
Storyboard.TargetProperty
=
"Visibility"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Visibility
>Visible</
Visibility
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
</
VisualStateGroup
>
<
VisualStateGroup
x:Name
=
"ValueStates"
>
<
VisualState
x:Name
=
"CellValid"
/>
<
VisualState
x:Name
=
"CellInvalid"
>
<
Storyboard
>
<
ObjectAnimationUsingKeyFrames
Storyboard.TargetName
=
"Background_Invalid"
Storyboard.TargetProperty
=
"Visibility"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Visibility
>Visible</
Visibility
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
<
VisualState
x:Name
=
"CellInvalidUnfocused"
>
<
Storyboard
>
<
ObjectAnimationUsingKeyFrames
Storyboard.TargetName
=
"Background_Invalid_Unfocused"
Storyboard.TargetProperty
=
"Visibility"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
Visibility
>Visible</
Visibility
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
</
VisualStateGroup
>
<
VisualStateGroup
x:Name
=
"ExpandStateGroup"
>
<
VisualState
x:Name
=
"Expanded"
>
<
Storyboard
>
<
ObjectAnimationUsingKeyFrames
Storyboard.TargetName
=
"PART_CellBorder"
Storyboard.TargetProperty
=
"BorderThickness"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"00:00:00"
>
<
DiscreteObjectKeyFrame.Value
>
<
Thickness
>0</
Thickness
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
<
VisualState
x:Name
=
"Collapsed"
/>
</
VisualStateGroup
>
</
VisualStateManager.VisualStateGroups
>
<
Border
x:Name
=
"PART_CellBorder"
Background
=
"{Binding Background, RelativeSource={RelativeSource TemplatedParent}}"
BorderBrush
=
"{TemplateBinding VerticalGridLinesBrush}"
BorderThickness
=
"{Binding VerticalGridLinesWidth, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource GridLineWidthToThicknessConverter}, ConverterParameter=Right}"
/>
<
Border
x:Name
=
"Background_Over"
Background
=
"{telerik:Windows8Resource ResourceKey=StrongBrush}"
Opacity
=
"0.15"
BorderBrush
=
"{TemplateBinding VerticalGridLinesBrush}"
BorderThickness
=
"{Binding VerticalGridLinesWidth, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource GridLineWidthToThicknessConverter}, ConverterParameter=Right}"
Grid.Column
=
"2"
Grid.ColumnSpan
=
"2"
Visibility
=
"Collapsed"
/>
<
Border
x:Name
=
"Background_Selected"
Background
=
"{telerik:Windows8Resource ResourceKey=BasicBrush}"
BorderBrush
=
"{TemplateBinding VerticalGridLinesBrush}"
BorderThickness
=
"{Binding VerticalGridLinesWidth, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource GridLineWidthToThicknessConverter}, ConverterParameter=Right}"
Grid.Column
=
"2"
Grid.ColumnSpan
=
"2"
Visibility
=
"Collapsed"
/>
<
Border
x:Name
=
"Background_Invalid_Unfocused"
Visibility
=
"Collapsed"
BorderThickness
=
"1"
BorderBrush
=
"{telerik:Windows8Resource ResourceKey=ValidationBrush}"
Grid.Column
=
"2"
Grid.ColumnSpan
=
"2"
Opacity
=
"1"
/>
<
Border
x:Name
=
"Background_Invalid"
Background
=
"{telerik:Windows8Resource ResourceKey=MainBrush}"
BorderThickness
=
"1"
BorderBrush
=
"{telerik:Windows8Resource ResourceKey=ValidationBrush}"
Grid.Column
=
"2"
Grid.ColumnSpan
=
"2"
Visibility
=
"Collapsed"
>
<
ToolTipService.ToolTip
>
<
ToolTip
x:Name
=
"validationTooltip"
Placement
=
"Right"
Content
=
"{TemplateBinding Errors}"
Template
=
"{StaticResource GridViewCell_ValidationToolTipTemplate}"
/>
</
ToolTipService.ToolTip
>
<
Grid
Height
=
"22"
HorizontalAlignment
=
"Right"
VerticalAlignment
=
"Top"
Width
=
"22"
Background
=
"Transparent"
>
<
Path
Data
=
"M0,0 L4,0 L4,4 z"
Fill
=
"{telerik:Windows8Resource ResourceKey=ValidationBrush}"
Stretch
=
"Fill"
Margin
=
"0,1,1,0"
Height
=
"4"
VerticalAlignment
=
"Top"
HorizontalAlignment
=
"Right"
Width
=
"4"
/>
</
Grid
>
</
Border
>
<
Border
x:Name
=
"Background_Disabled"
Background
=
"{telerik:Windows8Resource ResourceKey=MainBrush}"
Opacity
=
"0.3"
Grid.Column
=
"2"
Grid.ColumnSpan
=
"2"
Visibility
=
"Collapsed"
/>
<
ContentPresenter
x:Name
=
"PART_ContentPresenter"
Margin
=
"{TemplateBinding Padding}"
Content
=
"{TemplateBinding Content}"
ContentTemplate
=
"{TemplateBinding ContentTemplate}"
VerticalAlignment
=
"{TemplateBinding VerticalContentAlignment}"
HorizontalAlignment
=
"{TemplateBinding HorizontalContentAlignment}"
/>
</
Grid
>
</
ControlTemplate
>
<
Style
x:Key
=
"GridViewCellStyle"
TargetType
=
"grid:GridViewCell"
>
<
Setter
Property
=
"Template"
Value
=
"{StaticResource GridViewCellTemplate}"
/>
<
Setter
Property
=
"BorderBrush"
Value
=
"{telerik:Windows8Resource ResourceKey=BasicBrush}"
/>
<
Setter
Property
=
"Padding"
Value
=
"5,0,3,0"
/>
<
Setter
Property
=
"BorderThickness"
Value
=
"0,0,1,0"
/>
<
Setter
Property
=
"VerticalContentAlignment"
Value
=
"Center"
/>
<
Setter
Property
=
"HorizontalContentAlignment"
Value
=
"Stretch"
/>
<
Setter
Property
=
"Background"
Value
=
"Transparent"
/>
<
Setter
Property
=
"SnapsToDevicePixels"
Value
=
"True"
/>
<
Setter
Property
=
"FocusVisualStyle"
Value
=
"{StaticResource FocusVisualStyle}"
/>
</
Style
>