0
或者,如果我需要這種功能,我是唯一選擇擴展原始樹視圖的選項嗎?有沒有辦法在默認的treeview中定義多個itemtemplate?
我想是這樣的,但有限定,使得它們都使用相同的項目,但應用不同的模板來創建這兩個點控制兩個不同的模板兩個itemspresenters。
<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>
是的,請ItemTemplateSelector使用它。 http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.itemtemplateselector.aspx – Nitesh