查找控件(例如标签)并在运行时分配其内容 mvvm wpf
我们的 Skins 文件夹中有一个 xaml 文件,设计师在其中为标签、单选按钮或复选框开发了一些样式。我需要在这个xaml文件中找到控件Label,并在运行时在virewModel中分配content属性,以便它可以根据数据库中的记录自动显示内容。如何实现这一目标。
请建议?
谢谢。
We have one xaml file in our Skins folder where designer has developed some styles for the labels,radiobuttons or checkboxes. I need to find the control, Label in this xaml file and assign the content property at runtime in virewModel so that it can automatically displays the content as per the records in the database. How to achieve this.
Kindly Suggest?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么不直接将
Label
的Content
属性绑定到您的视图模型:Why not just have the
Label
'sContent
property bound to your view model: