views:

164

answers:

1

Hi, 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!

A: 

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; } 
}
texmex5
Was this answer helpful or would you need more assistance?
texmex5
Cheers mate!! The following worked for me:public String Header { get { return this.label.Content.ToString();} set { this.label.Content = value; } }
cube1893