Wire dropdowns back to bindables

This commit is contained in:
Drew DeVault 2016-12-05 09:24:54 -05:00
parent bf33bded24
commit bf7ec397dd
1 changed files with 13 additions and 0 deletions

View File

@ -49,6 +49,18 @@ void Bindable_ValueChanged(object sender, EventArgs e)
dropdown.SelectedValue = bindable.Value;
}
void Dropdown_ValueChanged(object sender, EventArgs e)
{
bindable.Value = dropdown.SelectedValue;
}
protected override void Dispose(bool isDisposing)
{
bindable.ValueChanged -= Bindable_ValueChanged;
dropdown.ValueChanged -= Dropdown_ValueChanged;
base.Dispose(isDisposing);
}
public DropdownOption()
{
if (!typeof(T).IsEnum)
@ -69,6 +81,7 @@ public DropdownOption()
Items = items.Select(item => new StyledDropDownMenuItem<T>(item.Item1, item.Item2))
}
};
dropdown.ValueChanged += Dropdown_ValueChanged;
}
private class StyledDropDownMenu<U> : DropDownMenu<U>