diff --git a/AIDevGallery/Controls/ModelPicker/ModelOrApiPicker.xaml b/AIDevGallery/Controls/ModelPicker/ModelOrApiPicker.xaml index ccd2362b..cd849d0a 100644 --- a/AIDevGallery/Controls/ModelPicker/ModelOrApiPicker.xaml +++ b/AIDevGallery/Controls/ModelPicker/ModelOrApiPicker.xaml @@ -175,7 +175,8 @@ AutomationProperties.Name="More info" Content="{x:Bind utils:AppUtils.GetHardwareAcceleratorString((models:HardwareAccelerator))}" Style="{StaticResource TertiaryButtonStyle}" - ToolTipService.ToolTip="More info"> + ToolTipService.ToolTip="More info" + Background="{ThemeResource ButtonBackground}"> - + diff --git a/AIDevGallery/Controls/ModelPicker/ModelPickerViews/OnnxPickerView.xaml b/AIDevGallery/Controls/ModelPicker/ModelPickerViews/OnnxPickerView.xaml index 776a977a..86617537 100644 --- a/AIDevGallery/Controls/ModelPicker/ModelPickerViews/OnnxPickerView.xaml +++ b/AIDevGallery/Controls/ModelPicker/ModelPickerViews/OnnxPickerView.xaml @@ -14,6 +14,7 @@ xmlns:ui="using:CommunityToolkit.WinUI" xmlns:utils="using:AIDevGallery.Utils" xmlns:vm="using:AIDevGallery.ViewModels" + xmlns:controls="using:Microsoft.UI.Xaml.Controls" mc:Ignorable="d"> @@ -40,7 +41,7 @@ Grid.Row="1" TextWrapping="Wrap" Text="To use a custom model, convert it to a WindowsML-compatible format using the AI Toolkit conversion tool. Note: Currently, only select models are supported for conversion in AI Toolkit, with additional models coming soon." /> - + - + + ToolTipService.ToolTip="More info" + Background="{ThemeResource ButtonBackground}"> + ToolTipService.ToolTip="More info" + Background="{ThemeResource ButtonBackground}"> - + @@ -128,8 +128,8 @@ AutomationProperties.Name="{x:Bind Name}" CornerRadius="8"> - + diff --git a/AIDevGallery/Pages/APIs/APISelectionPage.xaml.cs b/AIDevGallery/Pages/APIs/APISelectionPage.xaml.cs index 8803a331..3dc5355d 100644 --- a/AIDevGallery/Pages/APIs/APISelectionPage.xaml.cs +++ b/AIDevGallery/Pages/APIs/APISelectionPage.xaml.cs @@ -4,6 +4,7 @@ using AIDevGallery.Models; using AIDevGallery.Samples; using AIDevGallery.Telemetry.Events; +using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Navigation; using System.Collections.Generic; @@ -41,6 +42,28 @@ protected override void OnNavigatedTo(NavigationEventArgs e) }; } + private static string GetContentText(object? content) + { + return content switch + { + string s => s, + TextBlock tb => tb.Text, + _ => string.Empty + }; + } + + private static TextBlock CreateWrappedText(string text) + { + return new TextBlock + { + Text = text, + TextWrapping = TextWrapping.Wrap, + MaxLines = 3, + TextTrimming = TextTrimming.None, + Margin = new Thickness(0, 0, 8, 0) + }; + } + private void SetupAPIs() { if (ModelTypeHelpers.ParentMapping.TryGetValue(ModelType.WCRAPIs, out List? innerItems)) @@ -51,19 +74,19 @@ private void SetupAPIs() { if (!string.IsNullOrWhiteSpace(apiDefinition.Category)) { - NavigationViewItem? existingItem = NavView.MenuItems.OfType().FirstOrDefault(i => i.Content is string name && name == apiDefinition.Category); + NavigationViewItem? existingItem = NavView.MenuItems.OfType().FirstOrDefault(i => GetContentText(i.Content) == apiDefinition.Category); if (existingItem == null) { - existingItem = new NavigationViewItem() { Content = apiDefinition.Category, Icon = new FontIcon() { Glyph = "\uF0E2" }, SelectsOnInvoked = false, IsExpanded = true }; + existingItem = new NavigationViewItem() { Content = CreateWrappedText(apiDefinition.Category), Icon = new FontIcon() { Glyph = "\uF0E2" }, SelectsOnInvoked = false, IsExpanded = true }; NavView.MenuItems.Add(existingItem); } - existingItem.MenuItems.Add(new NavigationViewItem() { Content = apiDefinition.Name, Icon = new FontIcon() { Glyph = apiDefinition.IconGlyph }, Tag = item }); + existingItem.MenuItems.Add(new NavigationViewItem() { Content = CreateWrappedText(apiDefinition.Name), Icon = new FontIcon() { Glyph = apiDefinition.IconGlyph }, Tag = item }); } else { - NavView.MenuItems.Add(new NavigationViewItem() { Content = apiDefinition.Name, Icon = new FontIcon() { Glyph = apiDefinition.IconGlyph }, Tag = item }); + NavView.MenuItems.Add(new NavigationViewItem() { Content = CreateWrappedText(apiDefinition.Name), Icon = new FontIcon() { Glyph = apiDefinition.IconGlyph }, Tag = item }); } } } diff --git a/AIDevGallery/Pages/Scenarios/ScenarioPage.xaml b/AIDevGallery/Pages/Scenarios/ScenarioPage.xaml index 87e96e9d..44bcc46b 100644 --- a/AIDevGallery/Pages/Scenarios/ScenarioPage.xaml +++ b/AIDevGallery/Pages/Scenarios/ScenarioPage.xaml @@ -164,7 +164,7 @@ x:Name="WinMlModelOptionsButton" Padding="0" Visibility="Collapsed" - AutomationProperties.Name="WinMl Model Options Button"> + AutomationProperties.Name="WinMl Model Options"> - + diff --git a/AIDevGallery/Samples/Open Source Models/Image Models/YOLOv4/YOLOObjectionDetection.xaml b/AIDevGallery/Samples/Open Source Models/Image Models/YOLOv4/YOLOObjectionDetection.xaml index c470b385..2a4d3e45 100644 --- a/AIDevGallery/Samples/Open Source Models/Image Models/YOLOv4/YOLOObjectionDetection.xaml +++ b/AIDevGallery/Samples/Open Source Models/Image Models/YOLOv4/YOLOObjectionDetection.xaml @@ -24,7 +24,7 @@ + MaxHeight="500"/> diff --git a/AIDevGallery/Samples/Open Source Models/Image Models/YOLOv4/YOLOObjectionDetection.xaml.cs b/AIDevGallery/Samples/Open Source Models/Image Models/YOLOv4/YOLOObjectionDetection.xaml.cs index 37942c34..0b7aeb17 100644 --- a/AIDevGallery/Samples/Open Source Models/Image Models/YOLOv4/YOLOObjectionDetection.xaml.cs +++ b/AIDevGallery/Samples/Open Source Models/Image Models/YOLOv4/YOLOObjectionDetection.xaml.cs @@ -157,7 +157,7 @@ private async Task DetectObjects(string filePath) UploadButton.Visibility = Visibility.Collapsed; DefaultImage.Source = new BitmapImage(new Uri(filePath)); - NarratorHelper.AnnounceImageChanged(DefaultImage, "Image changed: new upload."); // + NarratorHelper.AnnounceImageChanged(DefaultImage, "Photo changed: new upload."); // Bitmap image = new(filePath); @@ -228,7 +228,7 @@ private async Task DetectObjects(string filePath) UploadButton.Visibility = Visibility.Visible; }); - NarratorHelper.AnnounceImageChanged(DefaultImage, "Image changed: objects detected."); // + NarratorHelper.AnnounceImageChanged(DefaultImage, "Photo changed: objects detected."); // image.Dispose(); } } \ No newline at end of file diff --git a/AIDevGallery/Samples/Open Source Models/Language Models/SmartText.xaml b/AIDevGallery/Samples/Open Source Models/Language Models/SmartText.xaml index 30da0634..82dba535 100644 --- a/AIDevGallery/Samples/Open Source Models/Language Models/SmartText.xaml +++ b/AIDevGallery/Samples/Open Source Models/Language Models/SmartText.xaml @@ -13,6 +13,7 @@ + Margin="0,32,0,0" + IsTabStop="False"/> diff --git a/AIDevGallery/Samples/Open Source Models/Multimodal Models/DescribeImage.xaml.cs b/AIDevGallery/Samples/Open Source Models/Multimodal Models/DescribeImage.xaml.cs index 52ad5227..e52e0e2c 100644 --- a/AIDevGallery/Samples/Open Source Models/Multimodal Models/DescribeImage.xaml.cs +++ b/AIDevGallery/Samples/Open Source Models/Multimodal Models/DescribeImage.xaml.cs @@ -171,6 +171,8 @@ private async void LoadButton_Click(object sender, RoutedEventArgs e) await DescribeTheImage(); } + + LoadImageButton.Focus(FocusState.Programmatic); } private async void Button_Click(object sender, RoutedEventArgs e)