Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Making the converter internal
  • Loading branch information
Keboo committed May 16, 2022
commit dd088c6d1e7c9a87d8555fafb526f2d20a79b2f8
28 changes: 14 additions & 14 deletions MaterialDesignThemes.Wpf/Converters/SliderToolTipConverter.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
using System;
using System.Globalization;
using System.Text.RegularExpressions;
using System.Windows.Data;

namespace MaterialDesignThemes.Wpf.Converters
namespace MaterialDesignThemes.Wpf.Converters;

internal class SliderToolTipConverter : IMultiValueConverter
{
public class SliderToolTipConverter : IMultiValueConverter
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
if (values.Length >= 2 && values[1] is string format && !string.IsNullOrEmpty(format))
{
if (values.Length >= 2 && values[1] is string format && !string.IsNullOrEmpty(format))
try
{
return string.Format(culture, format, values[0]);
}
catch (FormatException) { }
return System.Convert.ChangeType(values[0], targetType, culture);
try
{
return string.Format(culture, format, values[0]);
}
catch (FormatException) { }
}

public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
=> throw new NotImplementedException();
return System.Convert.ChangeType(values[0], targetType, culture);
}

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