Tôi có một số TextBlock
mà tôi cần phải tự động kích thước theo chiều rộng TreeView
. TreeView
và TextBlock
đều được chứa trong một số StackPanel
. StackPanel
nằm trong một số Expander
. Chiều rộng của TreeView
nên tăng độ rộng của các đối tượng khác và tôi cần chiều cao của TextBlock
để thay đổi hiển thị toàn văn. Tất cả những nỗ lực của tôi đã dẫn đến việc TextBlock
thúc đẩy chiều rộng. Cảm ơn!Làm thế nào để bạn đặt một Textblock để Tự động hóa với chiều rộng của một TreeView?
<Expander IsEnabled="True" HorizontalAlignment="Right" Margin="0,8,8,53" x:Name="ExpanderBookMarks" Width="Auto" Foreground="#FF625B5B" ExpandDirection="Down" IsExpanded="True" Header="Bookmarks" Visibility="Hidden">
<StackPanel Name ="StackPanelBookmark" Orientation="Vertical" Width="{wpf:Binding Path=Width, ElementName=trvBookmarks, Mode=Default}">
<TreeView x:Name="trvBookmarks" ItemsSource="{Binding}"
ItemTemplateSelector="{StaticResource BookmarkTemplateSelector}"
Margin="0,0,0,0"
TreeViewItem.Selected="HandleTreeViewItemClick" AllowDrop="True"/>
<TextBlock x:Name="TextBlockBookmarkDiscription" TextWrapping="Wrap" Foreground="AntiqueWhite" Background="Transparent" Width="150">
This is the discription area and needs to be very long because the end user can put 400 charectors in.
</TextBlock>
</StackPanel>
<!--End of Dougs Treeview-->
</Expander>
+1 Legend. Cảm ơn. – ozczecho