-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Made all converter classes public #3767
Made all converter classes public #3767
Conversation
I'm questioning if all converters should straight up be made |
That is also a possibility. I get why you want to prevent maintaining them all. If you can give me a list of the ones were not available as a public StaticResource I can keep them internal. |
So I think making these public is probably fine. There is also an argument to be made, that since some people need to copy styles/templates into their own projects to make modifications having these also be internal makes the process more difficult as well. As a compromise, we added an Internal namespace and made the classes public. The idea here being that the library reserves the right to treat them as internal for the purpose of semantic versioning (there could be breaking API changes on minor versions), but the classes remain public to allow for people to continue to use them. Let me review these converters, but I think a compromise might simply be to create an Internal namespace within the converters namespace, and move some of the more purpose-built converters in there. |
@@ -3,7 +3,7 @@ | |||
|
|||
namespace MaterialDesignThemes.Wpf.Converters; | |||
|
|||
internal class ClockItemIsCheckedConverter(Func<DateTime> currentTimeGetter, ClockDisplayMode displayMode, bool is24Hours) : IValueConverter | |||
public class ClockItemIsCheckedConverter(Func<DateTime> currentTimeGetter, ClockDisplayMode displayMode, bool is24Hours) : IValueConverter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one I think we can leave internal since its only usages were in code and not XAML.
@@ -8,7 +8,7 @@ | |||
using System.Windows.Media.Effects; | |||
|
|||
namespace MaterialDesignThemes.Wpf.Converters; | |||
internal sealed class DialogBackgroundBlurConverter : IMultiValueConverter | |||
public sealed class DialogBackgroundBlurConverter : IMultiValueConverter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose moving this inside of a new MaterialDesignThemes.Wpf.Converters.Internal
namespace.
@@ -3,7 +3,7 @@ | |||
|
|||
namespace MaterialDesignThemes.Wpf.Converters; | |||
|
|||
internal class DoubleToCornerRadiusConverter : IValueConverter | |||
public class DoubleToCornerRadiusConverter : IValueConverter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose moving this inside of a new MaterialDesignThemes.Wpf.Converters.Internal
namespace.
@@ -3,8 +3,10 @@ | |||
|
|||
namespace MaterialDesignThemes.Wpf.Converters; | |||
|
|||
internal class DoubleToThicknessConverter : IValueConverter | |||
public class DoubleToThicknessConverter : IValueConverter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one looks like it has no usages. Can we just remove it instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed no references, so removed it
@@ -3,7 +3,7 @@ | |||
|
|||
namespace MaterialDesignThemes.Wpf.Converters; | |||
|
|||
internal class ExpanderRotateAngleConverter : IValueConverter | |||
public class ExpanderRotateAngleConverter : IValueConverter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose moving this inside of a new MaterialDesignThemes.Wpf.Converters.Internal
namespace.
@@ -4,7 +4,7 @@ | |||
|
|||
namespace MaterialDesignThemes.Wpf.Converters; | |||
|
|||
internal class FloatingHintTransformConverter : IMultiValueConverter | |||
public class FloatingHintTransformConverter : IMultiValueConverter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the only remaining references to this are in tests, can we just remove it along with the tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed no more usages, so removed it
@@ -3,7 +3,7 @@ | |||
|
|||
namespace MaterialDesignThemes.Wpf.Converters; | |||
|
|||
internal class SliderToolTipConverter : IMultiValueConverter | |||
public class SliderToolTipConverter : IMultiValueConverter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose moving this inside of a new MaterialDesignThemes.Wpf.Converters.Internal
namespace.
@@ -4,7 +4,7 @@ | |||
namespace MaterialDesignThemes.Wpf.Converters; | |||
|
|||
[ValueConversion(typeof(double), typeof(double), ParameterType = typeof(Orientation))] | |||
internal class SliderValueLabelPositionConverter : IValueConverter | |||
public class SliderValueLabelPositionConverter : IValueConverter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose moving this inside of a new MaterialDesignThemes.Wpf.Converters.Internal
namespace.
@@ -3,7 +3,7 @@ | |||
|
|||
namespace MaterialDesignThemes.Wpf.Converters; | |||
|
|||
internal class TextFieldClearButtonVisibilityConverter : IMultiValueConverter | |||
public class TextFieldClearButtonVisibilityConverter : IMultiValueConverter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose moving this inside of a new MaterialDesignThemes.Wpf.Converters.Internal
namespace.
@@ -3,7 +3,7 @@ | |||
|
|||
namespace MaterialDesignThemes.Wpf.Converters; | |||
|
|||
internal class TopThicknessConverter : IValueConverter | |||
public class TopThicknessConverter : IValueConverter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this only appears to be referenced by ObsoleteConverters.xaml
can we leave it as internal as the only usage of it would be from someone needing those obsolete converters?
I would propose, that we also decorate this class with the [Obsolete]
so it is clear it is no longer used directly by this library.
@Keboo I created a commit with the proposed changes handled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for doing that! It looks like two comments were missed (FloatingHintTextBlockMarginConverter, and FloatingHintOffsetCalculationConverter), and one additional comment.
/* Unmerged change from project 'MaterialDesignThemes.Wpf.Tests (net8.0-windows)' | ||
Before: | ||
Wpf.Converters.SliderToolTipConverter converter = new (); | ||
After: | ||
SliderToolTipConverter converter = new (); | ||
*/ | ||
Wpf.Converters.Internal.SliderToolTipConverter converter = new (); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I understand this comment. Is it still needed?
/* Unmerged change from project 'MaterialDesignThemes.Wpf.Tests (net8.0-windows)' | |
Before: | |
Wpf.Converters.SliderToolTipConverter converter = new (); | |
After: | |
SliderToolTipConverter converter = new (); | |
*/ | |
Wpf.Converters.Internal.SliderToolTipConverter converter = new (); | |
Wpf.Converters.Internal.SliderToolTipConverter converter = new (); |
@Keboo Good find. I just found out that github can "hide" comments under a button. Therefore I overlooked them while doing these changes. I handled them now. |
Awesome. Thank you for the quick update! |
#3732 removed global converter resources.
Unfortunately some converters were internal instead of public and therefore became inaccessible.
This PR makes all converters public.