Skip to content
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

Add Transform property to Brushes #5768

Closed
amwx opened this issue Apr 12, 2021 · 0 comments · Fixed by #6344
Closed

Add Transform property to Brushes #5768

amwx opened this issue Apr 12, 2021 · 0 comments · Fixed by #6344

Comments

@amwx
Copy link
Contributor

amwx commented Apr 12, 2021

Is your feature request related to a problem? Please describe.
Allow brushes to be transformed, which WPF, UWP, and WinUI all support
WPF:
https://docs.microsoft.com/en-us/dotnet/desktop/wpf/graphics-multimedia/brush-transformation-overview?view=netframeworkdesktop-4.8

WinUI/UWP have a Transform and RelativeTransform property directly on Brush
https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.media.brush?view=winrt-19041

I've been trying to port the new WinUI styles and they have a couple brushes that have scale transform applied:

 <LinearGradientBrush x:Key="TextControlElevationBorderBrush" MappingMode="Absolute" StartPoint="0,0" EndPoint="0,2">
                <LinearGradientBrush.RelativeTransform>
                    <ScaleTransform ScaleY="-1" CenterY="0.5"/>
                </LinearGradientBrush.RelativeTransform>
                <LinearGradientBrush.GradientStops>
                    <GradientStop Offset="0.5" Color="{StaticResource ControlStrongStrokeColorDefault}"/>
                    <GradientStop Offset="1.0" Color="{StaticResource ControlStrokeColorDefault}"/>
                </LinearGradientBrush.GradientStops>
</LinearGradientBrush>

These brushes are usually used for borders (from what I can tell) so a work around is to separate the border brush into a separate Border element and apply the transform there, but that's not as ideal

Describe the solution you'd like
I think either adding a Transform property to IBrush would work, or use a separate ITransformableBrush interface (naming for example) to just apply to Gradient/Image/etc. brushes since SolidColorBrush probably doesn't need this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant