我在ItemsControl中使用画布,其中的形状,如矩形,圆圈可以绘制。我想调整尺寸和移动绘制的形状。我试过使用装饰器,但没有找到在ItemsControl中使用装饰器的方法,这可能吗?
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<zc:ZoomableCanvas Loaded="Canvas_Loaded"
RealizationLimit="1000"
RealizationRate="10"
RealizationPriority="Background"
ApplyTransform="False"
Scale="{Binding ZoomableCanvas.Scale}"
Offset="{Binding ZoomableCanvas.Offset}" ClipToBounds="True"
Width="{Binding ZoomableCanvas.ActualWidth}"
Height="{Binding ZoomableCanvas.ActualHeight}"
>
</zc:ZoomableCanvas>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>发布于 2018-03-08 09:22:15
答案可能来得有点晚,但我还是写了出来供将来参考。
您正在使用的Canvas只有在驻留在AdornerDecorator中时才能显示装饰器。试试这个:
<AdornerDecorator>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<zc:ZoomableCanvas Loaded="Canvas_Loaded"
RealizationLimit="1000"
RealizationRate="10"
RealizationPriority="Background"
ApplyTransform="False"
Scale="{Binding ZoomableCanvas.Scale}"
Offset="{Binding ZoomableCanvas.Offset}"
ClipToBounds="True"
Width="{Binding ZoomableCanvas.ActualWidth}"
Height="{Binding ZoomableCanvas.ActualHeight}"
>
</zc:ZoomableCanvas>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</AdornerDecorator>我希望这能帮到你!
https://stackoverflow.com/questions/46417894
复制相似问题