This question is locked. New answers and comments are not allowed.
Hi there,
I've got a RadTreeView along these lines:
The tree is inside a grid column that also has an expander and a splitter associated with it, so the tree width itself expands to fit the available column space.
The item template is meant to show a name, then on the right hand side of the tree view, show a number.
The problem I'm having is that the Grid inside the HierarchicalDataTemplate does not expand to fill the available width, even if I explicitly set HorizontalAlignment to Stretch (which is the default anyway), so I don't get the numbers right-aligned as required.
I can't use a fixed width either.
Is there any way to get the Grid inside the ItemTemplate to take up all available width on the control, as the focus and selected visuals do, or is this not possible?
Thanks,
Sam
I've got a RadTreeView along these lines:
<
telerik:RadTreeView
x:Name
=
"treeview"
Background
=
"Transparent"
Margin
=
"0, 6, 0, 0"
BorderThickness
=
"0"
Grid.Row
=
"1"
IsEditable
=
"True"
IsTextSearchEnabled
=
"True"
BringIntoViewMode
=
"HeaderAndItems"
ItemsSource
=
"{Binding Items}"
SelectedItem
=
"{Binding SelectedItem, Mode=TwoWay}"
>
<!-- Item Template -->
<
telerik:RadTreeView.ItemTemplate
>
<
telerik:HierarchicalDataTemplate
ItemsSource
=
"{Binding ChildItems}"
>
<
telerik:ContainerBinding.ContainerBindings
>
<!-- Used to bind the treeview item to the data item for item tracking -->
<
telerik:ContainerBindingCollection
x:Name
=
"BindingsCollection"
>
<
telerik:ContainerBinding
PropertyName
=
"IsInEditMode"
Binding
=
"{Binding IsInEditMode, Mode=TwoWay}"
/>
</
telerik:ContainerBindingCollection
>
</
telerik:ContainerBinding.ContainerBindings
>
<
Grid
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"*"
/>
<
ColumnDefinition
Width
=
"Auto"
/>
</
Grid.ColumnDefinitions
>
<
TextBlock
Text
=
"{Binding Name}"
/>
<
TextBlock
Grid.Column
=
"1"
Margin
=
"10, 0, 0, 0"
Text
=
"{Binding InstrumentCount}"
/>
</
Grid
>
</
telerik:HierarchicalDataTemplate
>
</
telerik:RadTreeView.ItemTemplate
>
</
telerik:RadTreeView
>
The tree is inside a grid column that also has an expander and a splitter associated with it, so the tree width itself expands to fit the available column space.
The item template is meant to show a name, then on the right hand side of the tree view, show a number.
The problem I'm having is that the Grid inside the HierarchicalDataTemplate does not expand to fill the available width, even if I explicitly set HorizontalAlignment to Stretch (which is the default anyway), so I don't get the numbers right-aligned as required.
I can't use a fixed width either.
Is there any way to get the Grid inside the ItemTemplate to take up all available width on the control, as the focus and selected visuals do, or is this not possible?
Thanks,
Sam