This is a migrated thread and some comments may be shown as answers.

How to stretch item horizontally

4 Answers 98 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Henk
Top achievements
Rank 1
Henk asked on 09 Sep 2010, 02:14 PM

Hello,

In a RadTreeview I want to display an optional Textbox in each item.
I used a HierarchicalDataTemplate attached to the RadTreeview.
Now the width of the TextBox is equal to the width of the (header)text shown in the TextBlock.
I want to stretch the width of the TextBox to fill up the width of the whole item in the Treeview.
HorizontalAlignment= "Stretch" in the HierarchicalDataTemplate does not work.
Has anyone an idea to fix this?

   <telerik:HierarchicalDataTemplate x:Key="ItemTemplate" ItemsSource="{Binding Converter={StaticResource HierarchyConverter}}"
                                          telerik:ContainerBinding.ContainerBindings="{StaticResource BindingsCollection}">
            <Grid x:Name="HeaderRow" Width="Auto" HorizontalAlignment="Stretch">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <TextBox Text="{Binding OmsText, Mode=TwoWay}" Visibility="{Binding OmsVisiblity, Mode=TwoWay}" HorizontalAlignment="Stretch" Height="Auto" TextWrapping ="Wrap" Grid.Row="1" />
                <TextBlock Text="{Binding Text, Mode=TwoWay}" HorizontalAlignment="Stretch"/>
            </Grid>
</telerik:HierarchicalDataTemplate>

4 Answers, 1 is accepted

Sort by
0
Accepted
Kiril Stanoev
Telerik team
answered on 14 Sep 2010, 03:53 PM
Hello Henk,

You need to set HorizontalContentAlignment to Stretch of each RadTreeViewItem. To do that, you can set an ItemContainerStyle of RadTreeView:

<telerik:RadTreeView>
    <telerik:RadTreeView.ItemContainerStyle>
        <Style TargetType="telerik:RadTreeViewItem">
            <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        </Style>
    </telerik:RadTreeView.ItemContainerStyle>
</telerik:RadTreeView>

Let me know if it helps.

Kind regards,
Kiril Stanoev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Henk
Top achievements
Rank 1
answered on 15 Sep 2010, 04:05 PM
Thanks, the item stretches nicely now!
0
saw
Top achievements
Rank 1
answered on 10 Oct 2014, 06:41 AM
Hi,
I make value to "Left", but items not align to left side of the tree. Items are still keep small (considerable) space in left side of the tree.
0
Petar Mladenov
Telerik team
answered on 13 Oct 2014, 07:25 AM
Hi Saw,

Since this is a very old thread, is it possible for you to open a new support ticket with more details about your specific scenario ? We are not exactly sure what you wish to achieve. Thank you in advance for your cooperation.

Regards,
Petar Mladenov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
TreeView
Asked by
Henk
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Henk
Top achievements
Rank 1
saw
Top achievements
Rank 1
Petar Mladenov
Telerik team
Share this question
or