Ramaraj
Ramaraj

Reputation: 19

RadialGradientBrush and PathGradientBrush in UWP

I am looking for a solution to use RadialGradientBrush and PathGradientBrush in UWP XAML.

I can use the LinearGradientBrush from Windows.UI.Xaml.Media like below

<StackPanel>
  <Rectangle Width="200" Height="100">
    <Rectangle.Fill>
      <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
        <GradientStop Color="Yellow" Offset="0.0" />
        <GradientStop Color="Red" Offset="0.25" />
        <GradientStop Color="Blue" Offset="0.75" />
        <GradientStop Color="LimeGreen" Offset="1.0" />
      </LinearGradientBrush>
    </Rectangle.Fill>
  </Rectangle>
</StackPanel>

I found that “Windows Runtime XAML vocabulary doesn't support RadialGradientBrush and PathGradientBrush” from this link.

Is there any other work around that we can make to get the functionality of RadialGradientBrush and PathGradientBrush in UWP XAML? similar to GDI

Note: I cannot use Win2D or Direct2D for my use case.

Upvotes: 0

Views: 649

Answers (2)

Michael Hawker - MSFT
Michael Hawker - MSFT

Reputation: 1580

We've added a Win2D Interop helper to directly support most of the RadialGradientBrush in the UWP Community Toolkit.

Upvotes: 1

Martin Zikmund
Martin Zikmund

Reputation: 39082

Unfortunately no, these two are not yet supported in UWP, so you must use Win2D (it supports CanvasRadialGradientBrush) or alike to simulate them manually...

Upvotes: 2

Related Questions