首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ItemsControl内部的Adorner

ItemsControl内部的Adorner
EN

Stack Overflow用户
提问于 2017-09-26 04:36:15
回答 1查看 318关注 0票数 0

我在ItemsControl中使用画布,其中的形状,如矩形,圆圈可以绘制。我想调整尺寸和移动绘制的形状。我试过使用装饰器,但没有找到在ItemsControl中使用装饰器的方法,这可能吗?

代码语言:javascript
复制
                <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>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-03-08 09:22:15

答案可能来得有点晚,但我还是写了出来供将来参考。

您正在使用的Canvas只有在驻留在AdornerDecorator中时才能显示装饰器。试试这个:

代码语言:javascript
复制
<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>

我希望这能帮到你!

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46417894

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档