[UWP] Fixed a crash hidden a DatePicker (Xamarin.Forms 4.5-pre4) (#9820)
* [UWP] Fixed a crash hidden a DatePicker (Xamarin.Forms 4.5-pre4) * Fixed build
This commit is contained in:
Родитель
fd7799157a
Коммит
b00152ba2d
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<controls:TestContentPage
|
||||||
|
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:controls="clr-namespace:Xamarin.Forms.Controls"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
x:Class="Xamarin.Forms.Controls.Issues.Issue9783"
|
||||||
|
Title="Issue 9783">
|
||||||
|
<ContentPage.Content>
|
||||||
|
<StackLayout>
|
||||||
|
<Label
|
||||||
|
Text="Below we have a hidden DatePicker and another one visible. If there is no exception, the test has passed."
|
||||||
|
TextColor="White"
|
||||||
|
BackgroundColor="Black"/>
|
||||||
|
<DatePicker
|
||||||
|
IsVisible="True"/>
|
||||||
|
<DatePicker
|
||||||
|
IsVisible="False"/>
|
||||||
|
</StackLayout>
|
||||||
|
</ContentPage.Content>
|
||||||
|
</controls:TestContentPage>
|
|
@ -0,0 +1,21 @@
|
||||||
|
using Xamarin.Forms.CustomAttributes;
|
||||||
|
|
||||||
|
namespace Xamarin.Forms.Controls.Issues
|
||||||
|
{
|
||||||
|
[Issue(IssueTracker.Github, 9783, "DatePicker begin to cause Exception in version 4.5.0-282-pre4 and above in some situations",
|
||||||
|
PlatformAffected.UWP)]
|
||||||
|
public partial class Issue9783 : TestContentPage
|
||||||
|
{
|
||||||
|
public Issue9783()
|
||||||
|
{
|
||||||
|
#if APP
|
||||||
|
InitializeComponent();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Init()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -184,6 +184,10 @@
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Issue9355.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Issue9355.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Issue8784.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Issue8784.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Issue9360.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Issue9360.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Issue9783.xaml.cs">
|
||||||
|
<DependentUpon>Issue9783.xaml</DependentUpon>
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Issue9694.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Issue9694.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)RefreshViewTests.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)RefreshViewTests.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Issue7338.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Issue7338.cs" />
|
||||||
|
@ -1845,4 +1849,10 @@
|
||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Issue9783.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -89,7 +89,9 @@ namespace Xamarin.Forms.Platform.UWP
|
||||||
|
|
||||||
// We also have to intercept the VSM changes on the DatePicker's button
|
// We also have to intercept the VSM changes on the DatePicker's button
|
||||||
var button = Control.GetDescendantsByName<Windows.UI.Xaml.Controls.Button>("FlyoutButton").FirstOrDefault();
|
var button = Control.GetDescendantsByName<Windows.UI.Xaml.Controls.Button>("FlyoutButton").FirstOrDefault();
|
||||||
InterceptVisualStateManager.Hook(button.GetFirstDescendant<Windows.UI.Xaml.Controls.Grid>(), button, Element);
|
|
||||||
|
if (button != null)
|
||||||
|
InterceptVisualStateManager.Hook(button.GetFirstDescendant<Windows.UI.Xaml.Controls.Grid>(), button, Element);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
|
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||||
|
|
|
@ -75,7 +75,9 @@ namespace Xamarin.Forms.Platform.UWP
|
||||||
|
|
||||||
// We also have to intercept the VSM changes on the TimePicker's button
|
// We also have to intercept the VSM changes on the TimePicker's button
|
||||||
var button = Control.GetDescendantsByName<Windows.UI.Xaml.Controls.Button>("FlyoutButton").FirstOrDefault();
|
var button = Control.GetDescendantsByName<Windows.UI.Xaml.Controls.Button>("FlyoutButton").FirstOrDefault();
|
||||||
InterceptVisualStateManager.Hook(button.GetFirstDescendant<Windows.UI.Xaml.Controls.Grid>(), button, Element);
|
|
||||||
|
if (button != null)
|
||||||
|
InterceptVisualStateManager.Hook(button.GetFirstDescendant<Windows.UI.Xaml.Controls.Grid>(), button, Element);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
|
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче