これはおそらくばかげた質問のように思えるかもしれませんが、私は WPF に非常に慣れていないので、ご容赦ください。悲しいことに、UI は私の主なスキル領域ではないため、WPF の概念を理解するのに苦労しています。
ツリー ビューを含むドック パネルを含むユーザー コントロールがあります。ツリー ビューは、うまく機能している階層データ テンプレートを使用してバインドされています。すべての項目とサブ コントロールがバインドされており、大まかな仕上がりに満足しています。レイアウト結果。ただし、最後にバインドされたツリー ビュー アイテムの下にボタンを追加したいと考えていました。
基本的に、これは私が達成しようとしているものです:
現時点では、ツリービュー用とボタン用の2つの行を持つドックパネル内にグリッドがありますが、明らかにボタンはツリービューの一部ではありません。ツリーのスクロール領域内に配置したいビューの一部として表示され、最後の項目の後にのみ表示されます。
これが私の現在のXAMLです:
<DockPanel>
<Grid Width="Auto" Height="Auto">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="23"/>
</Grid.RowDefinitions>
<TreeView ItemsSource="{Binding Path=Steps}" FontFamily="Calibri" FontSize="14" DataContext="{Binding}" Grid.Row="0">
<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}"/>
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}"/>
<Setter Property="FontWeight" Value="Normal"/>
<Setter Property="Margin" Value="20,20,0,0"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="FontWeight" Value="Bold"/>
</Trigger>
</Style.Triggers>
</Style>
</TreeView.ItemContainerStyle>
<TreeView.Resources>
<HierarchicalDataTemplate DataType="{x:Type local:StepViewModel}" ItemsSource="{Binding Segments}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Name}" />
</StackPanel>
</HierarchicalDataTemplate>
<DataTemplate DataType="{x:Type local:SegmentViewModel}">
<DockPanel HorizontalAlignment="Stretch" >
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
<myUserControl:SegmentLayout HorizontalAlignment="Stretch"/>
<TextBlock Text="{Binding Value}"/>
</StackPanel>
</DockPanel>
</DataTemplate>
</TreeView.Resources>
</TreeView>
<Button HorizontalAlignment="Left" Content="Add Step" Name="addStepButton" Height="23" Width="103" Grid.Row="1"/>
</Grid>
ああ、あなたが尋ねる前に、はい、私は基本的にSharePointワークフローデザイナーをリッピングしています. SPのものに。私はビジネス上の決定を下すのではなく、ただのコード モンキーです ;) .
どうもありがとう
ポール