或者,如果我想要该功能,我唯一的选择是扩展原始树视图吗?
我想要这样的东西,但是两个 itempresenter 定义了两个不同的模板,以便它们都使用相同的项目,但应用不同的模板在这两个位置创建控件。
<ControlTemplate>
<Grid>
<wpfExp:SignalNameBox x:Name="TreeViewTimeTextBox" Grid.Row="0" Grid.Column="0"
Height="{Binding RelativeSource = {RelativeSource AncestorType={x:Type wpfExp:GraphViewer}}, Path=GraphHeight}"
Width="200"
Margin="19,0,0,0"
MainText="Time"
/>
<wpfExp:SignalGraphAxis
x:Name="signal_axis"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
GraphHeight="{Binding RelativeSource = {RelativeSource AncestorType={x:Type wpfExp:GraphViewer}}, Path=GraphHeight}"
MinWidth="10"
MinHeight="10"
PenColor="{Binding ElementName=AxisColorPicker, Path=SelectedColor, Mode=OneWay}"
PenWidth="{Binding RelativeSource = {RelativeSource AncestorType={x:Type wpfExp:GraphViewer}}, Path=GraphPenWidth, Mode=OneWay}"
MaxTimeValue="{Binding RelativeSource = {RelativeSource AncestorType={x:Type wpfExp:GraphViewer}}, Path=_SignalDataViewModel.MaxTimeValue}"
TimeUnit="{Binding RelativeSource = {RelativeSource AncestorType={x:Type wpfExp:GraphViewer}}, Path = TimeUnit}"
AxisDivisionUnit="{Binding RelativeSource = {RelativeSource AncestorType={x:Type wpfExp:GraphViewer}}, Path = AxisDivisionUnit}"
/>
<StackPanel>
<ItemsPresenter/>
</StackPanel>
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<StackPanel>
<ItemsPresenter/>
</StackPanel>
</ScrollViewer>
</Grid>
</ControlTemplate>