xamluwpfluent-design

uwp conditional xaml giving property not found error


I am creating a uwp app using windows template studio and using hamburger menu originally made by uwp community toolkit. And I want to add some fluent design features to my app. because my min version is creators update which lacks fluent design features so I wanna add these features with conditional xaml

min target : creators update target : fall creators update

code

<controls:HamburgerMenu
    x:Name="NavigationMenu"
    IsAcrylicBrushPresent:PaneBackground="{ThemeResource SystemControlAltHighAcrylicWindowBrush}"
......

i also have added the following namespace in the page.

xmlns:IsAcrylicBrushPresent="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsTypePresent(Windows.UI.Xaml.Media.AcrylicBrush)"

ERROR

The property "PaneBackground" does not exist in the "http://schemas.microsoft.com/winfx/2006/xaml/presentation"


Solution

  • That's because "http://schemas.microsoft.com/winfx/2006/xaml/presentation" is for the native controls, not for the UWP Community Toolkit controls!

    You should use the same namespace you currently have for controls and just add the ?IsTypePresent(Windows.UI.Xaml.Media.AcrylicBrush) query bit.

    It should look something like this:

    xmlns:IsAcrylicBrushPresent="using:Microsoft.Toolkit.Uwp.UI.Controls?IsTypePresent(Windows.UI.Xaml.Media.AcrylicBrush)"