diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue9783.xaml b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue9783.xaml new file mode 100644 index 000000000..f8871d088 --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue9783.xaml @@ -0,0 +1,23 @@ + + + + + + + \ No newline at end of file diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue9783.xaml.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue9783.xaml.cs new file mode 100644 index 000000000..fc8469358 --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue9783.xaml.cs @@ -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() + { + + } + } +} \ No newline at end of file diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems index 3af763559..f15c3e702 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems @@ -184,6 +184,10 @@ + + Issue9783.xaml + Code + @@ -1845,4 +1849,10 @@ MSBuild:UpdateDesignTimeXaml + + + Designer + MSBuild:Compile + + \ No newline at end of file diff --git a/Xamarin.Forms.Platform.UAP/DatePickerRenderer.cs b/Xamarin.Forms.Platform.UAP/DatePickerRenderer.cs index 3a8457b5d..f945003db 100644 --- a/Xamarin.Forms.Platform.UAP/DatePickerRenderer.cs +++ b/Xamarin.Forms.Platform.UAP/DatePickerRenderer.cs @@ -89,7 +89,9 @@ namespace Xamarin.Forms.Platform.UWP // We also have to intercept the VSM changes on the DatePicker's button var button = Control.GetDescendantsByName("FlyoutButton").FirstOrDefault(); - InterceptVisualStateManager.Hook(button.GetFirstDescendant(), button, Element); + + if (button != null) + InterceptVisualStateManager.Hook(button.GetFirstDescendant(), button, Element); } protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) diff --git a/Xamarin.Forms.Platform.UAP/TimePickerRenderer.cs b/Xamarin.Forms.Platform.UAP/TimePickerRenderer.cs index d7172564e..62ff53eef 100644 --- a/Xamarin.Forms.Platform.UAP/TimePickerRenderer.cs +++ b/Xamarin.Forms.Platform.UAP/TimePickerRenderer.cs @@ -75,7 +75,9 @@ namespace Xamarin.Forms.Platform.UWP // We also have to intercept the VSM changes on the TimePicker's button var button = Control.GetDescendantsByName("FlyoutButton").FirstOrDefault(); - InterceptVisualStateManager.Hook(button.GetFirstDescendant(), button, Element); + + if (button != null) + InterceptVisualStateManager.Hook(button.GetFirstDescendant(), button, Element); } protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)