10

TextBlockの幅に自動サイズ変更する必要があるものがありTreeViewます。TreeViewとはTextBlock両方ともに含まれていStackPanelます。はのStackPanel中にありExpanderます。の幅はTreeView他のオブジェクトの幅を駆動する必要があり、TextBlock全文を表示するにはの高さを変更する必要があります。私のすべての努力はTextBlock、幅を動かすことにつながりました。ありがとう!

       <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>
4

1 に答える 1

18

これを試して:

<TextBlock Width="{Binding ElementName=trvBookmarks,Path=ActualWidth}" ... />
于 2008-12-19T18:02:06.067 に答える