-
Notifications
You must be signed in to change notification settings - Fork 730
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(xaml): Implement XamlCompositionBrushBase
- Loading branch information
Showing
5 changed files
with
91 additions
and
23 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
....Shared/Windows_UI_Xaml_Media/XamlCompositionBrushBase/XamlCompositionBrushBaseTests.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<UserControl | ||
x:Class="UITests.Windows_UI_Xaml_Media.XamlCompositionBrushBase.XamlCompositionBrushBaseTests" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:UITests.Windows_UI_Xaml_Media.XamlCompositionBrushBase" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" | ||
d:DesignHeight="300" | ||
d:DesignWidth="400" Loaded="UserControl_Loaded"> | ||
|
||
<Grid> | ||
<Grid x:Name="testGrid" Width="200" Height="200" HorizontalAlignment="Left" VerticalAlignment="Top"/> | ||
</Grid> | ||
</UserControl> |
38 changes: 38 additions & 0 deletions
38
...ared/Windows_UI_Xaml_Media/XamlCompositionBrushBase/XamlCompositionBrushBaseTests.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using Windows.UI; | ||
using Windows.UI.Xaml; | ||
using Windows.UI.Xaml.Controls; | ||
using Uno.UI.Samples.Controls; | ||
|
||
// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 | ||
|
||
namespace UITests.Windows_UI_Xaml_Media.XamlCompositionBrushBase | ||
{ | ||
[Sample("Windows.UI.Xaml.Media", Name = "XamlCompositionBrushBase", Description = "Provides a base class used to create XAML brushes that paint an area with a CompositionBrush.", IsManualTest = true)] | ||
public sealed partial class XamlCompositionBrushBaseTests : UserControl | ||
{ | ||
public XamlCompositionBrushBaseTests() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
|
||
private void UserControl_Loaded(object sender, RoutedEventArgs e) | ||
{ | ||
testGrid.Background = new TestBrush(); | ||
} | ||
} | ||
|
||
class TestBrush : Windows.UI.Xaml.Media.XamlCompositionBrushBase | ||
{ | ||
protected override void OnConnected() | ||
{ | ||
var compositor = Window.Current.Compositor; | ||
var brush = compositor.CreateLinearGradientBrush(); | ||
brush.ColorStops.Add(compositor.CreateColorGradientStop(0.0f, Colors.Black)); | ||
brush.ColorStops.Add(compositor.CreateColorGradientStop(1.0f, Colors.White)); | ||
brush.StartPoint = new(); | ||
brush.EndPoint = new(200, 200); | ||
|
||
CompositionBrush = brush; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters