<
DataTemplate
x:Key
=
"headerTemplate"
>
<
Grid
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"*"
/>
<
ColumnDefinition
Width
=
"Auto"
/>
</
Grid.ColumnDefinitions
>
<
TextBlock
Text
=
"Test Left"
/>
<
TextBlock
Text
=
"Test Right"
Grid.Column
=
"2"
/>
</
Grid
>
</
DataTemplate
>
When this template is used it just smashes Test Left and Test Right together on the left side of the header ignoring the * width for the middle column.
5 Answers, 1 is accepted
The behaviour you have come up with is expected since the Grid from the DataTemplate is applied in other Container from the Template of the RadTileViewItem. You either have to set explicit width of the Grid:
<
DataTemplate
x:Key
=
"headerTemplate"
>
<
Grid
Width
=
"200"
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"*"
/>
<
ColumnDefinition
Width
=
"Auto"
/>
</
Grid.ColumnDefinitions
>
<
TextBlock
Text
=
"Test Left"
/>
<
TextBlock
Text
=
"Test Right"
Grid.Column
=
"2"
/>
</
Grid
>
</
DataTemplate
>
Petar Mladenov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
But we cant use <
Grid
Width
=
"*"
>
, most of situations the width is flexible, we cant know a exact number.Then you have to edit the default template of the RadTileViewItem, for example like so:
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"Telerik_Windows_Controls_TileView:TileViewItemHeader"
>
<
Grid
>
<
VisualStateManager.VisualStateGroups
>
<
VisualStateGroup
x:Name
=
"TileStates"
>
<
VisualState
x:Name
=
"Maximized"
>
<
Storyboard
>
<
ObjectAnimationUsingKeyFrames
Duration
=
"0"
Storyboard.TargetName
=
"MaximizeToggleButton"
Storyboard.TargetProperty
=
"IsChecked"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
sys:Boolean
>True</
sys:Boolean
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
<
VisualState
x:Name
=
"Restored"
>
<
Storyboard
>
<
ObjectAnimationUsingKeyFrames
Duration
=
"0"
Storyboard.TargetName
=
"MaximizeToggleButton"
Storyboard.TargetProperty
=
"IsChecked"
>
<
DiscreteObjectKeyFrame
KeyTime
=
"0"
>
<
DiscreteObjectKeyFrame.Value
>
<
sys:Boolean
>False</
sys:Boolean
>
</
DiscreteObjectKeyFrame.Value
>
</
DiscreteObjectKeyFrame
>
</
ObjectAnimationUsingKeyFrames
>
</
Storyboard
>
</
VisualState
>
</
VisualStateGroup
>
</
VisualStateManager.VisualStateGroups
>
<
StackPanel
>
<
Border
Background
=
"{TemplateBinding Background}"
BorderBrush
=
"{StaticResource TileView_HeaderBorder}"
BorderThickness
=
"{StaticResource TileView_HeaderBorder_Thickness}"
CornerRadius
=
"{StaticResource TileView_HeaderBorder_CornerRadius}"
Padding
=
"10 0 7 0"
>
<
Grid
MinHeight
=
"28"
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"*"
/>
<
ColumnDefinition
Width
=
"Auto"
/>
</
Grid.ColumnDefinitions
>
<
Border
x:Name
=
"GripBarElement"
Background
=
"Transparent"
>
<
ContentPresenter
x:Name
=
"HeaderElement"
HorizontalAlignment
=
"Stretch"
VerticalAlignment
=
"Center"
ContentTemplate
=
"{TemplateBinding HeaderTemplate}"
/>
</
Border
>
<
telerik:RadToggleButton
x:Name
=
"MaximizeToggleButton"
Grid.Column
=
"1"
Command
=
"Telerik_Windows_Controls_TileView:TileViewCommands.ToggleTileState"
Style
=
"{StaticResource maximizeToggleStyle}"
/>
</
Grid
>
</
Border
>
You can find this realized in the attached solution. Please let us know if it satisfies you.
Petar Mladenov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
This property is public from the official Q2 2011 SP (0920) version of RadControls. Please make sure that you use Q2 2011 or Q3 version of RadControls.
We agree that this area in RadTileView needs improvement and you can vote for this related feature request, this way increasing its development priority.
Petar Mladenov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>