public void Persist(object bindableObject, PropertyInfo pi, object control)
{
var listBox = control as ListBox;
if (listBox == null)
return;
if (!listBox.Enabled || !listBox.Visible)
return;
object value = pi.GetValue(bindableObject, null);
if (value is IDomainObject)
{
PropertyHelper.SetValue(bindableObject, pi, IdManager.New(listBox.SelectedValue));
}
else if (value is Enum)
{
PropertyHelper.SetValue(bindableObject, pi, listBox.SelectedValue);
}
else
{
PropertyHelper.SetValue(bindableObject, pi, listBox.SelectedValue);
}
}