Compare commits
2 Commits
2281ec80ae
...
3315b758ad
Author | SHA1 | Date | |
---|---|---|---|
3315b758ad | |||
4cd1114def |
19
Elwig/Controls/BoolToValueConverter.cs
Normal file
19
Elwig/Controls/BoolToValueConverter.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace Elwig.Controls {
|
||||||
|
public class BoolToValueConverter<T> : IValueConverter {
|
||||||
|
public T FalseValue { get; set; }
|
||||||
|
public T TrueValue { get; set; }
|
||||||
|
|
||||||
|
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
|
||||||
|
return (bool)value ? TrueValue : FalseValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
|
||||||
|
return value?.Equals(TrueValue) ?? false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class BoolToStringConverter : BoolToValueConverter<string> { }
|
||||||
|
}
|
@@ -1,5 +1,5 @@
|
|||||||
using Elwig.Helpers;
|
using Elwig.Helpers;
|
||||||
using System.ComponentModel;
|
using System;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
namespace Elwig.Windows {
|
namespace Elwig.Windows {
|
||||||
@@ -11,9 +11,9 @@ namespace Elwig.Windows {
|
|||||||
Context = new();
|
Context = new();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnClosing(CancelEventArgs evt) {
|
protected override void OnClosed(EventArgs evt) {
|
||||||
|
base.OnClosed(evt);
|
||||||
Context.Dispose();
|
Context.Dispose();
|
||||||
base.OnClosing(evt);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user