Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,5 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return Binding.DoNothing;
}
=> Binding.DoNothing;
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,5 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value;
}
=> value;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@ public class NullableToVisibilityConverter : IValueConverter
public Visibility NotNullValue { get; set; } = Visibility.Visible;

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value == null ? NullValue : NotNullValue;
}
=> value == null ? NullValue : NotNullValue;

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return Binding.DoNothing;
}
=> Binding.DoNothing;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ public object Convert(object[] values, Type targetType, object parameter, Cultur

public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
if (value is Point)
if (value is Point point)
{
var point = (Point)value;
return new object[] { point.X, point.Y };
return [point.X, point.Y];
}

return new object[0];
return [];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ public object Convert(object[] values, Type targetType, object parameter, Cultur

return Binding.DoNothing;

var percent = (value - min) / (max - min);
var length = percent * containerLength;
double percent = (value - min) / (max - min);
double length = percent * containerLength;

return length > containerLength ? containerLength : length;
}

public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
=> throw new NotImplementedException();
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ private static Color RgbaToRgb(Color rgba, object background)
_ => Colors.White
};

var alpha = (double)rgba.A / byte.MaxValue;
var alphaReverse = 1 - alpha;
double alpha = (double)rgba.A / byte.MaxValue;
double alphaReverse = 1 - alpha;

return Color.FromRgb(
(byte)(alpha * rgba.R + alphaReverse * backgroundColor.R),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class ShadowOpacityMaskConverter : IMultiValueConverter

double blurRadius = dropShadow.BlurRadius;

Rect rect = new Rect(
var rect = new Rect(
-blurRadius,
-blurRadius,
width + blurRadius + blurRadius,
Expand Down
37 changes: 0 additions & 37 deletions src/MaterialDesignThemes.Wpf/Converters/SizeToRectConverter.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
{
Orientation.Horizontal => (-width * 0.5) + halfGripWidth,
Orientation.Vertical => -width - margin,
_ => throw new ArgumentOutOfRangeException()
_ => throw new ArgumentOutOfRangeException(nameof(parameter))
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ namespace MaterialDesignThemes.Wpf.Converters;
public class SnackbarMessageTypeConverter : TypeConverter
{
public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType)
{
return sourceType == typeof(string) || base.CanConvertFrom(context, sourceType);
}
=> sourceType == typeof(string) || base.CanConvertFrom(context, sourceType);

public override object? ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object value)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@ public class TextFieldHintVisibilityConverter : IValueConverter
public Visibility IsNotEmptyValue { get; set; } = Visibility.Hidden;

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return string.IsNullOrEmpty((value ?? "").ToString()) ? IsEmptyValue : IsNotEmptyValue;
}
=> string.IsNullOrEmpty((value ?? "").ToString()) ? IsEmptyValue : IsNotEmptyValue;

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return Binding.DoNothing;
}
=> Binding.DoNothing;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,17 @@ namespace MaterialDesignThemes.Wpf.Converters;
public class TimeToVisibilityConverter : MarkupExtension, IValueConverter
{
public override object ProvideValue(IServiceProvider serviceProvider)
{
return this;
}
=> this;

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var time = (DateTime)value;

var isPm = ((time.Hour >= 13) || (time.Hour == 0));
bool isPm = ((time.Hour >= 13) || (time.Hour == 0));

return isPm ? Visibility.Visible : Visibility.Collapsed;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return Binding.DoNothing;
}
=> Binding.DoNothing;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,5 @@ public class TreeListViewIndentConverter : IMultiValueConverter
}

public object?[]? ConvertBack(object? value, Type[] targetTypes, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
=> throw new NotImplementedException();
}