繁体   English   中英

在折线上使用数据模板

[英]using a datatemplate on Polylines

我尝试直接使用 Datatemplate 将 Observablecolletion.Points 中的 X 和 Y 绑定。 原因是我想稍后在 X 和 Y 上使用转换器。 我做了这样的绑定。

<ItemsControl ItemsSource="{Binding Measurements}">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <ItemsControl ItemsSource="{Binding Points}">
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Polyline Margin="20">
                                    <Polyline.Points>
                                        <Point X="{Binding X}"/>
                                        <Point Y="{Binding Y }"/>
                                    </Polyline.Points>
                                </Polyline>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>

出于某种原因,问题是数据模板被完全忽略了。 WPF 显示在我的 uercontroll 中,我将折线添加到测量中,但从未通过我的数据模板。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM