Can please anyone help, I am working on a UWP app and I want TextBlock to wrap the text inside it according to window width. That Textblock is inside Grid which is inside TreeView.
Now when I resize my app window it doesn't do anything.
I want it to look like this and don't have fixed width but to change dynamically with window:
This is my XAML code:
<TreeView Name="ItemsTreeView" SelectionMode="Multiple" ItemsSource="{x:Bind DataSource}" CanReorderItems="False" CanDrag="False" CanDragItems="False" AllowDrop="False" Margin="0,40,0,0">
<TreeView.ItemTemplate>
<DataTemplate x:DataType="local:Item">
<TreeViewItem ItemsSource="{x:Bind Children}" Background="{ThemeResource SystemAltMediumLowColor}" HorizontalAlignment="Stretch">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Image Source="{Binding Image}" Grid.Column="0" Margin="0 5 10 5" Width="50" Height="40"></Image>
<TextBlock Text="{Binding Name}" Grid.Column="1" VerticalAlignment="Center" Width="500" TextWrapping="Wrap"/>
</Grid>
</TreeViewItem>
</DataTemplate>
</TreeView.ItemTemplate>
</TreeView>