J'ai un TextBlock
que j'ai besoin d'autosize à la largeur d'un TreeView
. Le TreeView
et le TextBlock
sont tous deux contenus dans un StackPanel
. Le StackPanel
est à l'intérieur d'un Expander
. La largeur de TreeView
devrait conduire la largeur des autres objets et j'ai besoin de la hauteur du TextBlock
pour changer pour afficher le texte intégral. Tous mes efforts ont abouti à la TextBlock
conduite de la largeur. Merci!Comment définir un bloc de texte à autosize à la largeur d'un 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 Légende. Merci. – ozczecho