开发者

Expression Blend: How to create User Control with dynamic headline?

开发者 https://www.devze.com 2022-12-28 18:49 出处:网络
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开发者_C百科 can I achieve to edit the content proper

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开发者_C百科 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!


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; } 
}
0

精彩评论

暂无评论...
验证码 换一张
取 消