From bf7ec397dd365740027a3a582a191f578f184302 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Mon, 5 Dec 2016 09:24:54 -0500 Subject: [PATCH] Wire dropdowns back to bindables --- osu.Game/Overlays/Options/DropdownOption.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/osu.Game/Overlays/Options/DropdownOption.cs b/osu.Game/Overlays/Options/DropdownOption.cs index 0ba9811d35..3cdc6da2ab 100644 --- a/osu.Game/Overlays/Options/DropdownOption.cs +++ b/osu.Game/Overlays/Options/DropdownOption.cs @@ -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(item.Item1, item.Item2)) } }; + dropdown.ValueChanged += Dropdown_ValueChanged; } private class StyledDropDownMenu : DropDownMenu