[英]ItemTemplate DesignTime hints for custom control
I would like to create custom control with ItemsSource, which ItemTemplate for these items. 我想使用ItemsSource创建自定义控件,其中的ItemTemplate用于这些项目。
I have made it working, but one thing is left: 我已经做到了,但是还剩下一件事:
I would like to have DesignTime helper for binding within DataTemplate. 我希望有DesignTime助手在DataTemplate中进行绑定。 Right now I can bind properties from Collection object, but there's no hints in XAML like with other bindings.
现在,我可以绑定Collection对象的属性,但是XAML中没有其他绑定的提示。
Of course I can do something like this: 我当然可以做这样的事情:
<DataTemplate>
<StackPanel d:DataContext="{d:DesignInstance models:User}">
<Label Content="{Binding FirstName}" />
<Label Content="{Binding LastName}" />
</StackPanel>
</DataTemplate>
But I would like to avoid DesignTime instances entered manually. 但我想避免手动输入DesignTime实例。
Is there a way to do this? 有没有办法做到这一点?
<DataTemplate DataType={x:Type User}>
By telling the DataTemplate the type that it represents; 通过告诉DataTemplate它代表的类型; intellisense will give you DesignTime hints as to the properties available for Binding expressions
intellisense将为您提供有关绑定表达式可用属性的DesignTime提示
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.