Browse Source

StorageLocationPicker: fix switching from a configuration-specific location to the base location.

The CoerceValue-callback is not called by WPF for values set by the control itself, so it was setting ProjectProperty.Location to PropertyStorageLocations.Unchanged instead of PropertyStorageLocations.Base.
4.x
Daniel Grunwald 12 years ago
parent
commit
a9fafbe40f
  1. 10
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/StorageLocationPicker.cs

10
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/StorageLocationPicker.cs

@ -79,7 +79,11 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -79,7 +79,11 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
static object CoerceLocation(DependencyObject d, object baseValue)
{
PropertyStorageLocations location = (PropertyStorageLocations)baseValue;
return CoerceLocation((PropertyStorageLocations)baseValue);
}
static PropertyStorageLocations CoerceLocation(PropertyStorageLocations location)
{
if ((location & PropertyStorageLocations.ConfigurationAndPlatformSpecific) != 0) {
// remove 'Base' flag if any of the specific flags is set
location &= ~PropertyStorageLocations.Base;
@ -132,9 +136,9 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -132,9 +136,9 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
item.SetValueToExtension(MenuItem.HeaderProperty, new StringParseExtension(text));
item.Click += delegate(object sender, RoutedEventArgs e) {
if ((this.Location & location) == 0) {
this.Location |= location;
SetCurrentValue(LocationProperty, CoerceLocation(this.Location | location));
} else {
this.Location &= ~location;
SetCurrentValue(LocationProperty, CoerceLocation(this.Location & ~location));
}
e.Handled = true;
};

Loading…
Cancel
Save