Skip to content

Commit

Permalink
fix: Windows is appying the proper style.
Browse files Browse the repository at this point in the history
GetTemplateChild on Windows uses Uno.Themes / GetTemplateChild extension class instead of Microsoft.UI.Xaml.Controls.
  • Loading branch information
mcNets committed Oct 13, 2024
1 parent e08ca82 commit d9ef3df
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Uno.Gallery/Views/SamplePages/AutoSuggestBoxSamplePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Uno.Gallery.ViewModels;
using Microsoft.UI.Xaml.Controls;
using Uno.Gallery.Helpers;
using Microsoft.UI.Xaml.Controls.Primitives;

namespace Uno.Gallery.Views.Samples
{
Expand All @@ -18,14 +19,22 @@ public AutoSuggestBoxSamplePage()

private void AutoSuggestBoxSamplePage_Loaded(object sender, RoutedEventArgs e)
{
#if HAS_UNO
var desc = VisualTreeHelperEx.GetDescendants(this).OfType<AutoSuggestBox>();

foreach (var item in desc)
{
// Windows specific
//var popups = VisualTreeHelperEx.GetDescendants(item).OfType<Popup>();
//foreach (var popup in popups)
//{
// popup.EnsureXamlControlsResources(true);
//}

var border = item.GetTemplateChild("SuggestionsContainer") as Border;
border?.EnsureXamlControlsResources(true);
}

#endif
Loaded -= AutoSuggestBoxSamplePage_Loaded;
}

Expand Down

0 comments on commit d9ef3df

Please sign in to comment.