diff --git a/HedgeModManager/Controls/FormItem.xaml.cs b/HedgeModManager/Controls/FormItem.xaml.cs index 015cf2e3..5b15ccd5 100644 --- a/HedgeModManager/Controls/FormItem.xaml.cs +++ b/HedgeModManager/Controls/FormItem.xaml.cs @@ -79,20 +79,31 @@ public UIElement CreateUiElement(FormElement element) HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Height = 20, - DataContext = element + DataContext = element, }; - enums.ForEach(x => box.Items.Add(x)); - + + foreach (var val in enums) + { + var item = new ComboBoxItem() + { + Content = val.DisplayName, + DataContext = val, + ToolTip = new ToolTip() { Content = string.Join("\r\n", val.Description)} + }; + box.Items.Add(item); + } + box.SetBinding(Selector.SelectedValueProperty, "Value"); if (element.Value != null) { var value = enums.FirstOrDefault(x => x.Value == element.Value.ToString()); - box.SelectedValue = value ?? enums.First(); + var i = enums.IndexOf(value); + box.SelectedIndex= i < 0 ? 0 : i; } else { - box.SelectedValue = enums.First(); + box.SelectedIndex = 0; } return box; diff --git a/HedgeModManager/Properties/AssemblyInfo.cs b/HedgeModManager/Properties/AssemblyInfo.cs index 2ef9a2e5..d5e23877 100644 --- a/HedgeModManager/Properties/AssemblyInfo.cs +++ b/HedgeModManager/Properties/AssemblyInfo.cs @@ -51,5 +51,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("7.1.0.0")] +[assembly: AssemblyVersion("7.1.0.1")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/HedgeModManager/UI/FormBuilder.cs b/HedgeModManager/UI/FormBuilder.cs index 1bf4c39e..3dd3e818 100644 --- a/HedgeModManager/UI/FormBuilder.cs +++ b/HedgeModManager/UI/FormBuilder.cs @@ -127,8 +127,8 @@ public void SaveIni(string path) { foreach (var element in group.Elements) { - if (element.Value is FormEnum) - file[group.Name][element.Name] = ((FormEnum)element.Value)?.Value; + if (element.Value is FrameworkElement && ((FrameworkElement)element.Value).DataContext is FormEnum) + file[group.Name][element.Name] = ((FormEnum)((FrameworkElement)element.Value).DataContext)?.Value; else file[group.Name][element.Name] = element.Value?.ToString() ?? element.DefaultValue.ToString(); } diff --git a/HedgeModManager/UI/ModConfigWindow.xaml b/HedgeModManager/UI/ModConfigWindow.xaml index 9033e5fa..9363db62 100644 --- a/HedgeModManager/UI/ModConfigWindow.xaml +++ b/HedgeModManager/UI/ModConfigWindow.xaml @@ -13,7 +13,7 @@ - +