Skip to content

Commit

Permalink
Windows 10 future version - July 2018 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
oldnewthing committed Jul 19, 2018
1 parent 157c9eb commit 0ce8466
Show file tree
Hide file tree
Showing 132 changed files with 8,093 additions and 1,291 deletions.
4 changes: 4 additions & 0 deletions Samples/XamlUIBasics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ To obtain information about Windows 10 development, go to the [Windows Dev Cente

To obtain information about Microsoft Visual Studio and the tools for developing Windows apps, go to [Visual Studio](http://go.microsoft.com/fwlink/?LinkID=532422)

To contact the authors, please reach out to ControlsGallery@microsoft.com

## Related topics

[XAML app UI, start to finish](http://msdn.microsoft.com/library/windows/apps/dn263191.aspx)
Expand All @@ -34,6 +36,8 @@ Each control page in the application has links to the relevant MSDN documentatio

[Install a prebuilt version of this sample](https://www.microsoft.com/store/productId/9MSVH128X2ZT).

[Windows UI Library (WinUI)](https://docs.microsoft.com/en-us/uwp/toolkits/winui/)

## Related samples

[RSS reader sample](https://github.com/Microsoft/Windows-appsample-rssreader)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public AllControlsPage()

protected override void OnNavigatedTo(NavigationEventArgs e)
{
var menuItem = NavigationRootPage.Current.NavigationView.MenuItems.Cast<NavigationViewItem>().First();
var menuItem = NavigationRootPage.Current.NavigationView.MenuItems.Cast<Microsoft.UI.Xaml.Controls.NavigationViewItem>().ElementAt(1);
menuItem.IsSelected = true;
NavigationRootPage.Current.NavigationView.Header = menuItem.Content;
Items = ControlInfoDataSource.Instance.Groups.SelectMany(g => g.Items).OrderBy(i => i.Title).ToList();
Expand Down
4 changes: 3 additions & 1 deletion Samples/XamlUIBasics/cs/AppUIBasics/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
xmlns:local="using:AppUIBasics"
xmlns:common="using:AppUIBasics.Common">
<Application.Resources>

<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<local:ItemTemplates />
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls"/>
</ResourceDictionary.MergedDictionaries>

<ResourceDictionary.ThemeDictionaries>
Expand Down Expand Up @@ -468,6 +468,8 @@
</Setter.Value>
</Setter>
</Style>


</ResourceDictionary>
</Application.Resources>
</Application>
25 changes: 23 additions & 2 deletions Samples/XamlUIBasics/cs/AppUIBasics/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@ public App()
}
}

public void EnableSound(bool withSpatial = false)
{
ElementSoundPlayer.State = ElementSoundPlayerState.On;

if(!withSpatial)
ElementSoundPlayer.SpatialAudioMode = ElementSpatialAudioMode.Off;
else
ElementSoundPlayer.SpatialAudioMode = ElementSpatialAudioMode.On;
}

public static TEnum GetEnum<TEnum>(string text) where TEnum : struct
{
if (!typeof(TEnum).GetTypeInfo().IsEnum)
Expand Down Expand Up @@ -132,10 +142,15 @@ protected override async void OnLaunched(LaunchActivatedEventArgs args)
//{
// this.DebugSettings.EnableFrameRateCounter = true;
//}

if (System.Diagnostics.Debugger.IsAttached)
{
this.DebugSettings.BindingFailed += DebugSettings_BindingFailed;
}
#endif
//draw into the title bar
CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;

//remove the solid-colored backgrounds behind the caption controls and system back button
ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar;
titleBar.ButtonBackgroundColor = Colors.Transparent;
Expand All @@ -150,6 +165,11 @@ protected override async void OnLaunched(LaunchActivatedEventArgs args)
await EnsureWindow(args);
}

private void DebugSettings_BindingFailed(object sender, BindingFailedEventArgs e)
{

}

protected async override void OnActivated(IActivatedEventArgs args)
{
await EnsureWindow(args);
Expand All @@ -172,7 +192,7 @@ private async Task EnsureWindow(IActivatedEventArgs args)
RootTheme = GetEnum<ElementTheme>(savedTheme);
}

Type targetPageType = typeof(AllControlsPage);
Type targetPageType = typeof(NewControlsPage);
string targetPageArguments = string.Empty;

if (args.Kind == ActivationKind.Launch)
Expand Down Expand Up @@ -227,6 +247,7 @@ bool IsMatching(string parent, string expression)
}

rootFrame.Navigate(targetPageType, targetPageArguments);
((Microsoft.UI.Xaml.Controls.NavigationViewItem)(((NavigationRootPage)(Window.Current.Content)).NavigationView.MenuItems[0])).IsSelected = true;

// Ensure the current window is active
Window.Current.Activate();
Expand Down
Loading

0 comments on commit 0ce8466

Please sign in to comment.