I have MyUserControlone that contains a label labeland BO public Person Person {get;set;}.
I want Person to Namealways contact the labelfollowing:
( "Name: {0}", person.Name) if person != null
and
( "Name: {0}", "(none)") ifperson == null
moreover, if a person’s name is changed, the tag will automatically update it.
is there a possibility of such a binding?
"Dirty" option:
private void label_LayoutUpdated(object sender, EventArgs e)
{
label.Content = string.Format("Name: {0}", _Person == null ?
"(none)" : _Person.Name);
}
source
share