From 9040a18aa2e70efd2fd587677db465be30ca98c9 Mon Sep 17 00:00:00 2001 From: Niels Laute Date: Mon, 9 Jan 2023 18:23:09 +0100 Subject: [PATCH 1/4] Improvements to sample renderer --- .../AppLoadingView.xaml.cs | 8 +- .../Renderers/ToolkitSampleRenderer.xaml | 166 ++++++++++-------- .../Renderers/ToolkitSampleRenderer.xaml.cs | 7 +- 3 files changed, 103 insertions(+), 78 deletions(-) diff --git a/CommunityToolkit.Labs.Shared/AppLoadingView.xaml.cs b/CommunityToolkit.Labs.Shared/AppLoadingView.xaml.cs index 261f14cd6..bcd796817 100644 --- a/CommunityToolkit.Labs.Shared/AppLoadingView.xaml.cs +++ b/CommunityToolkit.Labs.Shared/AppLoadingView.xaml.cs @@ -85,14 +85,14 @@ protected override void OnNavigatedTo(NavigationEventArgs e) return; } -#if LABS_ALL_SAMPLES - ScheduleNavigate(typeof(Shell), sampleDocs); -#else +//#if LABS_ALL_SAMPLES +// ScheduleNavigate(typeof(Shell), sampleDocs); +//#else var samples = FindReferencedSamples().ToArray(); (IEnumerable Samples, IEnumerable Docs, bool AreDocsFirst) displayInfo = (samples, sampleDocs, false); ScheduleNavigate(typeof(TabbedPage), displayInfo); -#endif +//#endif } // Needed because Frame.Navigate doesn't work inside of the OnNavigatedTo override. diff --git a/CommunityToolkit.Labs.Shared/Renderers/ToolkitSampleRenderer.xaml b/CommunityToolkit.Labs.Shared/Renderers/ToolkitSampleRenderer.xaml index bb6d1d9b6..87fe33604 100644 --- a/CommunityToolkit.Labs.Shared/Renderers/ToolkitSampleRenderer.xaml +++ b/CommunityToolkit.Labs.Shared/Renderers/ToolkitSampleRenderer.xaml @@ -1,4 +1,4 @@ - + - + - - @@ -38,12 +36,12 @@ - + - + @@ -51,9 +49,17 @@ - + + + + + + + + + @@ -68,6 +74,7 @@ + @@ -77,20 +84,35 @@ - - - - - - + + + + + + + + + + + + + + + + @@ -98,98 +120,98 @@ - - + - - - - - - + - - + - - - - 0 - 0 - - - - 14 - + + + 0 + 0,0,0,0 + + + + + + 14 + - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/CommunityToolkit.Labs.Shared/Renderers/ToolkitSampleRenderer.xaml.cs b/CommunityToolkit.Labs.Shared/Renderers/ToolkitSampleRenderer.xaml.cs index af0c3e48f..416ffa85f 100644 --- a/CommunityToolkit.Labs.Shared/Renderers/ToolkitSampleRenderer.xaml.cs +++ b/CommunityToolkit.Labs.Shared/Renderers/ToolkitSampleRenderer.xaml.cs @@ -156,13 +156,12 @@ private async Task LoadData() CSharpCode = await GetMetadataFileContents(Metadata, "xaml.cs"); var sampleControlInstance = (UIElement)Metadata.SampleControlFactory(); - + // Custom control-based sample options. if (Metadata.SampleOptionsPaneType is not null && Metadata.SampleOptionsPaneFactory is not null) { SampleOptionsPaneInstance = (UIElement)Metadata.SampleOptionsPaneFactory(sampleControlInstance); } - // Source generater-based sample options else if (sampleControlInstance is IToolkitSampleGeneratedOptionPropertyContainer propertyContainer) { @@ -175,6 +174,10 @@ private async Task LoadData() SampleOptions = propertyContainer.GeneratedPropertyMetadata }; } + else + { + OptionsControl.Visibility = Visibility.Collapsed; + } // Generated options must be assigned before attempting to render the control, // else some platforms will nullref from XAML but not properly ignore the exception when binding to generated properties. From 634636efa9501ea3edcdfa77b354393cf2f9ffa6 Mon Sep 17 00:00:00 2001 From: Niels Laute Date: Mon, 9 Jan 2023 18:25:08 +0100 Subject: [PATCH 2/4] Hide unused Settings button --- CommunityToolkit.Labs.Shared/AppLoadingView.xaml.cs | 8 ++++---- CommunityToolkit.Labs.Shared/Pages/Shell.xaml | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CommunityToolkit.Labs.Shared/AppLoadingView.xaml.cs b/CommunityToolkit.Labs.Shared/AppLoadingView.xaml.cs index bcd796817..261f14cd6 100644 --- a/CommunityToolkit.Labs.Shared/AppLoadingView.xaml.cs +++ b/CommunityToolkit.Labs.Shared/AppLoadingView.xaml.cs @@ -85,14 +85,14 @@ protected override void OnNavigatedTo(NavigationEventArgs e) return; } -//#if LABS_ALL_SAMPLES -// ScheduleNavigate(typeof(Shell), sampleDocs); -//#else +#if LABS_ALL_SAMPLES + ScheduleNavigate(typeof(Shell), sampleDocs); +#else var samples = FindReferencedSamples().ToArray(); (IEnumerable Samples, IEnumerable Docs, bool AreDocsFirst) displayInfo = (samples, sampleDocs, false); ScheduleNavigate(typeof(TabbedPage), displayInfo); -//#endif +#endif } // Needed because Frame.Navigate doesn't work inside of the OnNavigatedTo override. diff --git a/CommunityToolkit.Labs.Shared/Pages/Shell.xaml b/CommunityToolkit.Labs.Shared/Pages/Shell.xaml index f530cdd91..17e03b1c3 100644 --- a/CommunityToolkit.Labs.Shared/Pages/Shell.xaml +++ b/CommunityToolkit.Labs.Shared/Pages/Shell.xaml @@ -1,4 +1,4 @@ - + From 9e6f51f9974d4da7a7430bdf1bde2f8d0e604253 Mon Sep 17 00:00:00 2001 From: Niels Laute Date: Thu, 12 Jan 2023 14:10:02 +0100 Subject: [PATCH 3/4] Layout tweaks --- .../Renderers/ToolkitSampleRenderer.xaml | 127 +++++++++++------- .../Renderers/ToolkitSampleRenderer.xaml.cs | 2 +- .../Styles/Buttons.xaml | 6 +- 3 files changed, 78 insertions(+), 57 deletions(-) diff --git a/CommunityToolkit.Labs.Shared/Renderers/ToolkitSampleRenderer.xaml b/CommunityToolkit.Labs.Shared/Renderers/ToolkitSampleRenderer.xaml index 87fe33604..278713cca 100644 --- a/CommunityToolkit.Labs.Shared/Renderers/ToolkitSampleRenderer.xaml +++ b/CommunityToolkit.Labs.Shared/Renderers/ToolkitSampleRenderer.xaml @@ -21,7 +21,7 @@ - + @@ -52,7 +52,6 @@ - @@ -60,6 +59,10 @@ + + + + @@ -91,13 +94,22 @@ - + + + + BorderThickness="1,0,0,0" + RowSpacing="8"> @@ -108,50 +120,55 @@ - - - - - + + + - - - - - + - + - + + + + @@ -206,6 +230,7 @@ diff --git a/CommunityToolkit.Labs.Shared/Renderers/ToolkitSampleRenderer.xaml.cs b/CommunityToolkit.Labs.Shared/Renderers/ToolkitSampleRenderer.xaml.cs index 416ffa85f..e525740ef 100644 --- a/CommunityToolkit.Labs.Shared/Renderers/ToolkitSampleRenderer.xaml.cs +++ b/CommunityToolkit.Labs.Shared/Renderers/ToolkitSampleRenderer.xaml.cs @@ -176,7 +176,7 @@ private async Task LoadData() } else { - OptionsControl.Visibility = Visibility.Collapsed; + OptionsScrollViewer.Visibility = Visibility.Collapsed; } // Generated options must be assigned before attempting to render the control, diff --git a/CommunityToolkit.Labs.Shared/Styles/Buttons.xaml b/CommunityToolkit.Labs.Shared/Styles/Buttons.xaml index 59618bd37..67bc77932 100644 --- a/CommunityToolkit.Labs.Shared/Styles/Buttons.xaml +++ b/CommunityToolkit.Labs.Shared/Styles/Buttons.xaml @@ -348,9 +348,5 @@ - + From 9ff6a7eded9a71604453ba3c40e0099c6b7acec9 Mon Sep 17 00:00:00 2001 From: Niels Laute Date: Thu, 12 Jan 2023 14:22:03 +0100 Subject: [PATCH 4/4] Update Shell.xaml --- CommunityToolkit.Labs.Shared/Pages/Shell.xaml | 1 - 1 file changed, 1 deletion(-) diff --git a/CommunityToolkit.Labs.Shared/Pages/Shell.xaml b/CommunityToolkit.Labs.Shared/Pages/Shell.xaml index 17e03b1c3..68e4d9b62 100644 --- a/CommunityToolkit.Labs.Shared/Pages/Shell.xaml +++ b/CommunityToolkit.Labs.Shared/Pages/Shell.xaml @@ -20,7 +20,6 @@ Icon="ms-appx:///Assets/AppTitleBar.png" />