Expression Blend:如何创建具有动态标题的用户控件?

发布于 2024-08-30 18:59:40 字数 189 浏览 3 评论 0原文

我创建了一个用户控件并添加了一个“标签”资源。我给这个标签一个默认的内容属性。如果我将此 UserControl 包含在我的项目中,如何实现在属性窗口中编辑内容属性?我想要像 TabItem 一样的行为:Properties->CommonProperties 下有一个“Header”选项,您可以在其中定义自己的标题。

有什么想法吗?干杯!

I created a UserControl and added a "label" asset. I gave this label a default content property. If I include this UserControl in my projekt, how can I achieve to edit the content property in the properties window? I want to have a behaviour like the TabItem: There is a "Header" option under Properties->CommonProperties where you can define your own header.

Any ideas? Cheers!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

诺曦 2024-09-06 18:59:40

在您的 UserControl 代码隐藏类 MyUserControl.cs 中,您需要添加一个公共属性,然后就完成了,该属性将通过 Expression Blend 属性面板可见并可编辑。

public string MyProperty {  
    get { return this.label.Text;}  
    set { this.label.Text = value; } 
}

In your UserControl codebehind class MyUserControl.cs you'll need to add a public property and you're done, the property will be visible and editable via Expression Blend attributes panel.

public string MyProperty {  
    get { return this.label.Text;}  
    set { this.label.Text = value; } 
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文