-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
98 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:d="http://schemas.microsoft.com/dotnet/2021/maui/design" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:Microsoft.Maui.Controls.Xaml.UnitTests" | ||
x:Class="Microsoft.Maui.Controls.Xaml.UnitTests.Maui11204"> | ||
|
||
<ContentPage.Resources> | ||
<Style TargetType="Border" Class="BorderStyle" | ||
ApplyToDerivedTypes="true"> | ||
<Setter Property="VisualStateManager.VisualStateGroups"> | ||
<VisualStateGroupList> | ||
<VisualStateGroup x:Name="CommonStates"> | ||
<VisualState x:Name="State1"> | ||
<VisualState.Setters> | ||
<Setter Property="BackgroundColor" Value="Blue" /> | ||
<Setter Property="StrokeThickness" Value="2" /> | ||
</VisualState.Setters> | ||
</VisualState> | ||
</VisualStateGroup> | ||
</VisualStateGroupList> | ||
</Setter> | ||
</Style> | ||
</ContentPage.Resources> | ||
<StackLayout> | ||
<Border x:Name="border" | ||
BackgroundColor="FloralWhite"> | ||
<VisualStateManager.VisualStateGroups> | ||
<VisualStateGroup x:Name="CommonStates"> | ||
<VisualState x:Name="State1"> | ||
<VisualState.Setters> | ||
<Setter Property="BackgroundColor" Value="Blue" /> | ||
<Setter Property="StrokeThickness" Value="2" /> | ||
</VisualState.Setters> | ||
</VisualState> | ||
|
||
</VisualStateGroup> | ||
</VisualStateManager.VisualStateGroups> | ||
</Border> | ||
<Border x:Name="borderWithStyleClass" | ||
BackgroundColor="HotPink" | ||
StyleClass="BorderStyle"/> | ||
</StackLayout> | ||
</ContentPage> |
47 changes: 47 additions & 0 deletions
47
src/Controls/tests/Xaml.UnitTests/Issues/Maui11204.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,47 @@ | ||
using System; | ||
using Microsoft.Maui.ApplicationModel; | ||
using Microsoft.Maui.Controls.Core.UnitTests; | ||
using Microsoft.Maui.Graphics; | ||
using Microsoft.Maui.Devices; | ||
using Microsoft.Maui.Platform; | ||
using NUnit.Framework; | ||
|
||
|
||
namespace Microsoft.Maui.Controls.Xaml.UnitTests | ||
{ | ||
public partial class Maui11204 : ContentPage | ||
{ | ||
public Maui11204() => InitializeComponent(); | ||
public Maui11204(bool useCompiledXaml) | ||
{ | ||
//this stub will be replaced at compile time | ||
} | ||
|
||
[TestFixture] | ||
class Tests | ||
{ | ||
[SetUp] public void Setup() => AppInfo.SetCurrent(new MockAppInfo()); | ||
[TearDown] public void TearDown() => AppInfo.SetCurrent(null); | ||
|
||
[Test] | ||
public void VSMSetterOverrideManualValues([Values(false, true)] bool useCompiledXaml) | ||
{ | ||
var page = new Maui11204(useCompiledXaml); | ||
Assert.AreEqual(Colors.FloralWhite, page.border.BackgroundColor); | ||
VisualStateManager.GoToState(page.border, "State1"); | ||
Assert.AreEqual(2, page.border.StrokeThickness); | ||
Assert.AreEqual(Colors.Blue, page.border.BackgroundColor); | ||
} | ||
|
||
[Test] | ||
public void StyleVSMSetterOverrideManualValues([Values(false, true)] bool useCompiledXaml) | ||
{ | ||
var page = new Maui11204(useCompiledXaml); | ||
Assert.AreEqual(Colors.HotPink, page.borderWithStyleClass.BackgroundColor); | ||
VisualStateManager.GoToState(page.borderWithStyleClass, "State1"); | ||
Assert.AreEqual(2, page.borderWithStyleClass.StrokeThickness); | ||
Assert.AreEqual(Colors.Blue, page.borderWithStyleClass.BackgroundColor); | ||
} | ||
} | ||
} | ||
} |