Skip to content

Commit

Permalink
Merge pull request #54 from MaterialDesignInXAML/master
Browse files Browse the repository at this point in the history
Made all converter classes public (MaterialDesignInXAML#3767)
  • Loading branch information
adrbarros authored Jan 16, 2025
2 parents c87c20d + e0ab487 commit 857a7e8
Show file tree
Hide file tree
Showing 33 changed files with 63 additions and 273 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace MaterialDesignThemes.Wpf.Converters;

internal class BooleanAllConverter : IMultiValueConverter
public class BooleanAllConverter : IMultiValueConverter
{
public static readonly BooleanAllConverter Instance = new();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace MaterialDesignThemes.Wpf.Converters;

internal class BorderClipConverter : IMultiValueConverter
public class BorderClipConverter : IMultiValueConverter
{
public static readonly BorderClipConverter Instance = new();
public object Convert(object?[]? values, Type targetType, object? parameter, CultureInfo culture)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace MaterialDesignThemes.Wpf.Converters;

internal class FallbackBrushConverter : IMultiValueConverter
public class FallbackBrushConverter : IMultiValueConverter
{
public static readonly FallbackBrushConverter Instance = new();

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace MaterialDesignThemes.Wpf.Converters;

internal class GridLinesVisibilityBorderToThicknessConverter : IValueConverter
public class GridLinesVisibilityBorderToThicknessConverter : IValueConverter
{
public static readonly GridLinesVisibilityBorderToThicknessConverter Instance = new();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace MaterialDesignThemes.Wpf.Converters;

internal class HorizontalThicknessConverter : IValueConverter
public class HorizontalThicknessConverter : IValueConverter
{
public static readonly HorizontalThicknessConverter Instance = new();
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
using System.Windows.Data;
using System.Windows.Media.Effects;

namespace MaterialDesignThemes.Wpf.Converters;
internal sealed class DialogBackgroundBlurConverter : IMultiValueConverter
namespace MaterialDesignThemes.Wpf.Converters.Internal;

public sealed class DialogBackgroundBlurConverter : IMultiValueConverter
{
public static readonly DialogBackgroundBlurConverter Instance = new();
public object? Convert(object?[]? values, Type targetType, object? parameter, CultureInfo culture)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System.Globalization;
using System.Windows.Data;

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

internal class DoubleToCornerRadiusConverter : IValueConverter
public class DoubleToCornerRadiusConverter : IValueConverter
{
public static readonly DoubleToCornerRadiusConverter Instance = new();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System.Globalization;
using System.Windows.Data;

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

internal class ExpanderRotateAngleConverter : IValueConverter
public class ExpanderRotateAngleConverter : IValueConverter
{
public static readonly ExpanderRotateAngleConverter Instance = new();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
using System.Windows.Data;
using System.Windows.Media;

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

internal class FloatingHintTextBlockMarginConverter : IMultiValueConverter
public class FloatingHintTextBlockMarginConverter : IMultiValueConverter
{
public static readonly FloatingHintTextBlockMarginConverter Instance = new();
public object? Convert(object?[]? values, Type targetType, object? parameter, CultureInfo culture)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System.Globalization;
using System.Windows.Data;

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

internal class SliderToolTipConverter : IMultiValueConverter
public class SliderToolTipConverter : IMultiValueConverter
{
public static readonly SliderToolTipConverter Instance = new();
public object? Convert(object?[]? values, Type? targetType, object? parameter, CultureInfo? culture)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System.Globalization;
using System.Windows.Data;

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

[ValueConversion(typeof(double), typeof(double), ParameterType = typeof(Orientation))]
internal class SliderValueLabelPositionConverter : IValueConverter
public class SliderValueLabelPositionConverter : IValueConverter
{
public static readonly SliderValueLabelPositionConverter Instance = new();
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
Expand All @@ -15,7 +15,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
const double margin = 4.0;
return orientation switch
{
Orientation.Horizontal => (-width * 0.5) + halfGripWidth,
Orientation.Horizontal => -width * 0.5 + halfGripWidth,
Orientation.Vertical => -width - margin,
_ => throw new ArgumentOutOfRangeException(nameof(parameter))
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System.Globalization;
using System.Windows.Data;

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

internal class TextFieldClearButtonVisibilityConverter : IMultiValueConverter
public class TextFieldClearButtonVisibilityConverter : IMultiValueConverter
{
public Visibility ContentEmptyVisibility { get; set; } = Visibility.Hidden;

Expand Down
2 changes: 1 addition & 1 deletion src/MaterialDesignThemes.Wpf/Converters/IsDarkConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace MaterialDesignThemes.Wpf.Converters;

internal class IsDarkConverter : IValueConverter
public class IsDarkConverter : IValueConverter
{
public static readonly IsDarkConverter Instance = new();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace MaterialDesignThemes.Wpf.Converters;

internal class RemoveAlphaBrushConverter : IValueConverter, IMultiValueConverter
public class RemoveAlphaBrushConverter : IValueConverter, IMultiValueConverter
{
public static readonly RemoveAlphaBrushConverter Instance = new();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace MaterialDesignThemes.Wpf.Converters;

internal class StringLengthValueConverter : IValueConverter
public class StringLengthValueConverter : IValueConverter
{
public static readonly StringLengthValueConverter Instance = new();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace MaterialDesignThemes.Wpf.Converters;

[Obsolete]
internal class TopThicknessConverter : IValueConverter
{
public static readonly TopThicknessConverter Instance = new();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:MaterialDesignThemes.Wpf.Converters"
xmlns:convertersInternal="clr-namespace:MaterialDesignThemes.Wpf.Converters.Internal"
xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf">

<ResourceDictionary.MergedDictionaries>
Expand Down Expand Up @@ -269,7 +270,7 @@
<Grid.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="0" ScaleY="0" />
<TranslateTransform X="{Binding ActualWidth, ElementName=label, Converter={x:Static converters:SliderValueLabelPositionConverter.Instance}, ConverterParameter={x:Static Orientation.Horizontal}}" Y="-40" />
<TranslateTransform X="{Binding ActualWidth, ElementName=label, Converter={x:Static convertersInternal:SliderValueLabelPositionConverter.Instance}, ConverterParameter={x:Static Orientation.Horizontal}}" Y="-40" />
</TransformGroup>
</Grid.RenderTransform>
<AdornerDecorator CacheMode="{Binding RelativeSource={RelativeSource Self}, Path=(wpf:ShadowAssist.CacheMode)}">
Expand All @@ -289,7 +290,7 @@
Foreground="{DynamicResource MaterialDesign.Brush.Background}"
TextAlignment="Center">
<TextBlock.Text>
<MultiBinding Converter="{x:Static converters:SliderToolTipConverter.Instance}"
<MultiBinding Converter="{x:Static convertersInternal:SliderToolTipConverter.Instance}"
NotifyOnValidationError="True"
TargetNullValue=""
ValidatesOnDataErrors="True">
Expand Down Expand Up @@ -481,7 +482,7 @@
<Grid.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="0" ScaleY="0" />
<TranslateTransform X="{Binding ActualWidth, ElementName=label, Converter={x:Static converters:SliderValueLabelPositionConverter.Instance}, ConverterParameter={x:Static Orientation.Vertical}}" Y="-7" />
<TranslateTransform X="{Binding ActualWidth, ElementName=label, Converter={x:Static convertersInternal:SliderValueLabelPositionConverter.Instance}, ConverterParameter={x:Static Orientation.Vertical}}" Y="-7" />
</TransformGroup>
</Grid.RenderTransform>
<AdornerDecorator CacheMode="{Binding RelativeSource={RelativeSource Self}, Path=(wpf:ShadowAssist.CacheMode)}">
Expand All @@ -501,7 +502,7 @@
Foreground="{DynamicResource MaterialDesign.Brush.Background}"
TextAlignment="Center">
<TextBlock.Text>
<MultiBinding Converter="{x:Static converters:SliderToolTipConverter.Instance}"
<MultiBinding Converter="{x:Static convertersInternal:SliderToolTipConverter.Instance}"
NotifyOnValidationError="True"
TargetNullValue=""
ValidatesOnDataErrors="True">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:MaterialDesignThemes.Wpf.Converters"
xmlns:convertersInternal="clr-namespace:MaterialDesignThemes.Wpf.Converters.Internal"
xmlns:internal="clr-namespace:MaterialDesignThemes.Wpf.Internal"
xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf"
xmlns:behaviors="clr-namespace:MaterialDesignThemes.Wpf.Behaviors">
Expand All @@ -13,7 +14,7 @@
TargetType="{x:Type wpf:AutoSuggestBox}"
BasedOn="{StaticResource MaterialDesignTextBoxBase}">
<Style.Resources>
<converters:TextFieldClearButtonVisibilityConverter x:Key="ClearButtonVisibilityConverter" ContentEmptyVisibility="Collapsed" />
<convertersInternal:TextFieldClearButtonVisibilityConverter x:Key="ClearButtonVisibilityConverter" ContentEmptyVisibility="Collapsed" />
<converters:TextFieldPrefixTextVisibilityConverter x:Key="PrefixSuffixTextVisibilityConverter" HiddenState="Collapsed" />
<converters:BooleanToDashStyleConverter x:Key="BooleanToDashStyleConverter" TrueValue="{x:Static DashStyles.Solid}" />
<converters:ThicknessCloneConverter x:Key="HelperTextMarginConverter" CloneEdges="Left,Right" />
Expand Down
Loading

0 comments on commit 857a7e8

Please sign in to comment.