зеркало из https://github.com/DeGsoft/maui-linux.git
[WinRT/UWP] Update ZIndex on LowerChild/RaiseChild (#981)
This commit is contained in:
Родитель
ef076b8825
Коммит
02c93b6b99
|
@ -0,0 +1,115 @@
|
||||||
|
using Xamarin.Forms.CustomAttributes;
|
||||||
|
using Xamarin.Forms.Internals;
|
||||||
|
|
||||||
|
#if UITEST
|
||||||
|
using Xamarin.UITest;
|
||||||
|
using NUnit.Framework;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace Xamarin.Forms.Controls.Issues
|
||||||
|
{
|
||||||
|
[Preserve(AllMembers = true)]
|
||||||
|
[Issue(IssueTracker.Bugzilla, 38770, "RaiseChild and LowerChild do not work on Windows", PlatformAffected.WinRT)]
|
||||||
|
public class Bugzilla38770 : TestContentPage
|
||||||
|
{
|
||||||
|
protected override void Init()
|
||||||
|
{
|
||||||
|
var red = new BoxView
|
||||||
|
{
|
||||||
|
BackgroundColor = Color.Red,
|
||||||
|
WidthRequest = 50,
|
||||||
|
HeightRequest = 50,
|
||||||
|
TranslationX = 25
|
||||||
|
};
|
||||||
|
var green = new BoxView
|
||||||
|
{
|
||||||
|
BackgroundColor = Color.Green,
|
||||||
|
WidthRequest = 50,
|
||||||
|
HeightRequest = 50
|
||||||
|
};
|
||||||
|
var blue = new BoxView
|
||||||
|
{
|
||||||
|
BackgroundColor = Color.Blue,
|
||||||
|
WidthRequest = 50,
|
||||||
|
HeightRequest = 50,
|
||||||
|
TranslationX = -25
|
||||||
|
};
|
||||||
|
var boxStack = new StackLayout
|
||||||
|
{
|
||||||
|
Orientation = StackOrientation.Horizontal,
|
||||||
|
Spacing = 0,
|
||||||
|
Margin = new Thickness(0,50,0,0),
|
||||||
|
HorizontalOptions = LayoutOptions.Center,
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
red,
|
||||||
|
green,
|
||||||
|
blue
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var raiseButtons = new StackLayout
|
||||||
|
{
|
||||||
|
Orientation = StackOrientation.Horizontal,
|
||||||
|
HorizontalOptions = LayoutOptions.Center,
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
new Button
|
||||||
|
{
|
||||||
|
Text = "Raise Red",
|
||||||
|
WidthRequest = 110,
|
||||||
|
Command = new Command(() => boxStack.RaiseChild(red))
|
||||||
|
},
|
||||||
|
new Button
|
||||||
|
{
|
||||||
|
Text = "Raise Green",
|
||||||
|
WidthRequest = 110,
|
||||||
|
Command = new Command(() => boxStack.RaiseChild(green))
|
||||||
|
},
|
||||||
|
new Button
|
||||||
|
{
|
||||||
|
Text = "Raise Blue",
|
||||||
|
WidthRequest = 110,
|
||||||
|
Command = new Command(() => boxStack.RaiseChild(blue))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var lowerButtons = new StackLayout
|
||||||
|
{
|
||||||
|
Orientation = StackOrientation.Horizontal,
|
||||||
|
HorizontalOptions = LayoutOptions.Center,
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
new Button
|
||||||
|
{
|
||||||
|
Text = "Lower Red",
|
||||||
|
WidthRequest = 110,
|
||||||
|
Command = new Command(() => boxStack.LowerChild(red))
|
||||||
|
},
|
||||||
|
new Button
|
||||||
|
{
|
||||||
|
Text = "Lower Green",
|
||||||
|
WidthRequest = 110,
|
||||||
|
Command = new Command(() => boxStack.LowerChild(green))
|
||||||
|
},
|
||||||
|
new Button
|
||||||
|
{
|
||||||
|
Text = "Lower Blue",
|
||||||
|
WidthRequest = 110,
|
||||||
|
Command = new Command(() => boxStack.LowerChild(blue))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Content = new StackLayout
|
||||||
|
{
|
||||||
|
Children =
|
||||||
|
{
|
||||||
|
raiseButtons,
|
||||||
|
lowerButtons,
|
||||||
|
boxStack
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -91,6 +91,7 @@
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla37601.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla37601.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla38105.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla38105.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla38723.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla38723.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla38770.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla38827.xaml.cs">
|
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla38827.xaml.cs">
|
||||||
<DependentUpon>Bugzilla38827.xaml</DependentUpon>
|
<DependentUpon>Bugzilla38827.xaml</DependentUpon>
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
|
|
|
@ -62,6 +62,7 @@ namespace Xamarin.Forms.Platform.WinRT
|
||||||
{
|
{
|
||||||
element.ChildAdded -= OnChildAdded;
|
element.ChildAdded -= OnChildAdded;
|
||||||
element.ChildRemoved -= OnChildRemoved;
|
element.ChildRemoved -= OnChildRemoved;
|
||||||
|
element.ChildrenReordered -= OnChildrenReordered;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +74,7 @@ namespace Xamarin.Forms.Platform.WinRT
|
||||||
_isLoaded = true;
|
_isLoaded = true;
|
||||||
_renderer.Element.ChildAdded += OnChildAdded;
|
_renderer.Element.ChildAdded += OnChildAdded;
|
||||||
_renderer.Element.ChildRemoved += OnChildRemoved;
|
_renderer.Element.ChildRemoved += OnChildRemoved;
|
||||||
|
_renderer.Element.ChildrenReordered += OnChildrenReordered;
|
||||||
|
|
||||||
ReadOnlyCollection<Element> children = ElementController.LogicalChildren;
|
ReadOnlyCollection<Element> children = ElementController.LogicalChildren;
|
||||||
for (var i = 0; i < children.Count; i++)
|
for (var i = 0; i < children.Count; i++)
|
||||||
|
@ -151,5 +153,10 @@ namespace Xamarin.Forms.Platform.WinRT
|
||||||
view.Cleanup();
|
view.Cleanup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnChildrenReordered(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
EnsureZIndex();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Загрузка…
Ссылка в новой задаче