Merge branch 'master' into jamesmcroft/3506-carousel-automation

This commit is contained in:
James Croft 2021-01-21 07:39:51 +00:00 коммит произвёл GitHub
Родитель 7c8c126994 6174710c84
Коммит c544bb05a5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 24 добавлений и 11 удалений

Просмотреть файл

@ -195,8 +195,8 @@ namespace Microsoft.Toolkit.Uwp.SampleApp
{
try
{
var pageInstance = Activator.CreateInstance(CurrentSample.PageType);
SampleContent.Content = pageInstance;
SamplePage = Activator.CreateInstance(CurrentSample.PageType) as Page;
SampleContent.Content = SamplePage;
// Some samples use the OnNavigatedTo and OnNavigatedFrom
// Can't use Frame here because some samples depend on the current Frame
@ -206,7 +206,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp
if (method != null)
{
method.Invoke(pageInstance, new object[] { e });
method.Invoke(SamplePage, new object[] { e });
}
}
catch
@ -348,6 +348,8 @@ namespace Microsoft.Toolkit.Uwp.SampleApp
private void SamplePage_Loaded(object sender, RoutedEventArgs e)
{
SamplePage.Loaded -= SamplePage_Loaded;
if (CurrentSample != null && CurrentSample.HasXAMLCode)
{
_lastRenderedProperties = true;
@ -516,17 +518,23 @@ namespace Microsoft.Toolkit.Uwp.SampleApp
if (CurrentSample.HasType)
{
root = SamplePage?.FindDescendantByName("XamlRoot");
}
if (root is Panel)
{
// If we've defined a 'XamlRoot' element to host us as a panel, use that.
(root as Panel).Children.Clear();
(root as Panel).Children.Add(element);
if (root is Panel)
{
// If we've defined a 'XamlRoot' element to host us as a panel, use that.
(root as Panel).Children.Clear();
(root as Panel).Children.Add(element);
}
else
{
// if we didn't find a XamlRoot host, then we replace the entire content of
// the provided sample page with the XAML.
SamplePage.Content = element;
}
}
else
{
// Otherwise, just replace the entire page's content
// Otherwise, just replace our entire presenter's content
SampleContent.Content = element;
}
@ -675,7 +683,8 @@ namespace Microsoft.Toolkit.Uwp.SampleApp
}
}
private Page SamplePage => SampleContent.Content as Page;
// The Loaded Instance of the backing .xaml.cs Page (if any)
private Page SamplePage { get; set; }
private bool CanChangePaneState => !_onlyDocumentation;

Просмотреть файл

@ -1,8 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="AzureLatest" value="https://pkgs.dev.azure.com/dotnet/WindowsCommunityToolkit/_packaging/WindowsCommunityToolkit-MainLatest/nuget/v3/index.json" protocolVersion="3" />
<add key="MUX-Shared" value="https://pkgs.dev.azure.com/ms/microsoft-ui-xaml/_packaging/MUX-Shared/nuget/v3/index.json" />
</packageSources>
<disabledPackageSources>
<clear />
</disabledPackageSources>
</configuration>