2
我有一個ItemsControl
模板作爲UserControl的項目。 我的ItemsControl.Items
Panel
被模板化爲Canvas
。綁定ItemsTemplate數據模板和ItemsPanelTemplate屬性
現在,我手動設置這些我的用戶的width和height屬性,它看起來像這樣:
<ItemsControl x:Name="curveList"
ItemsSource="{Binding SplineVMList}"
Background="{x:Null}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Canvas x:Name="canvas" Margin="46,60,83,46"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<local:SplineControl Width="300" Height="300" Canvas.Bottom="0" Canvas.Left="0" IsSelected="{Binding IsSelected, Mode=TwoWay}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemContainerStyle>
<Style TargetType="ContentPresenter">
<Setter Property="Canvas.Bottom" Value="0"/>
<Setter Property="Canvas.Left" Value="0"/>
</Style>
</ItemsControl.ItemContainerStyle>
</ItemsControl>
我想是綁定width和height屬性我的用戶控件對我的畫布。 只是可能嗎?