65
我想數據綁定到這個ItemsControl
:設置畫布的屬性在一個ItemsControl DataTemplate中
<ItemsControl ItemsSource="{Binding Path=Nodes, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Canvas />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
通過使用此DataTemplate
,我想單獨正確地定位在Canvas
我Node
元素:
<DataTemplate DataType="{x:Type Model:EndNode}">
<Controls:EndNodeControl Canvas.Left="{Binding Path=XPos}" Canvas.Top="{Binding Path=YPos}" />
</DataTemplate>
但是,它沒有按預期工作。我所有的節點元素都在同一位置上彼此重疊。有關如何完成此任務的任何建議?
謝謝。我在5分鐘前自己找到了這個解決方案。我想我發佈這個問題有點快。 :) – atsjoo 2009-08-12 10:43:04
呵呵..我也喜歡那些AHA時刻;)..而且它並不全是壞的..但是有一天你的問題也許能幫助別人..你永遠不會知道! – Arcturus 2009-08-12 10:45:28
它確實,謝謝 – amaca 2009-08-24 16:34:32