Creating a converter is pretty simple right.
Have something like:
using System.Globalization;
using System.Windows;
using System.Windows.Data;
public class ResizeModeConverter : IValueConverter {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
return (bool)value ? ResizeMode.CanResize : ResizeMode.CanMinimize;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
throw new NotImplementedException();
}
}
and add this converter to your App.xaml Resources(Converter should be in a scope available to your Window
)
<Application.Resources>
<local:ResizeModeConverter x:Key="ResizeModeConverter" />
</Application.Resources>
Now in your Window
<Window ... ResizeMode="{Binding SomeProperty, Converter={StaticResource ResizeModeConverter}}">
Now when SomeProperty
is set to true or false you get your required behavior. You can set the property in your VM at startup after reading your local setting's or modify it at runtime and everything should be fine.