microsoft-ui-xaml: Regression with NavigationView now producing binding error when minimising it

Describe the bug

Updating my app to the latest WinUI version (1.5.240227000) I noticed I started getting a binding warning when I run it. The previous version (1.4.240211001) does not have this issue.

Error: Converter failed to convert value of type ‘Windows.Foundation.IReference`1<Microsoft.UI.Xaml.GridLength>’ to type ‘Double’; BindingExpression: Path=‘TemplateSettings.CompactPaneGridLength’ DataItem=‘Microsoft.UI.Xaml.Controls.SplitView’; target element is ‘Microsoft.UI.Xaml.Media.Animation.SplineDoubleKeyFrame’ (Name=‘null’); target property is ‘Value’ (type ‘Double’).

I was able to keep deleting code until I got it to dissapear and I got an app layout down to a single NavigationView.

<?xml version="1.0" encoding="utf-8"?>
<Window
    x:Class="NavViewBindingIssue.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:NavViewBindingIssue"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
    mc:Ignorable="d">
    <muxc:NavigationView>

    </muxc:NavigationView>
</Window>

If you launch this there will be no binding issues. If you minmise the nav by clicking the hamburger button it will generate the above binding issue.

Additionally if you make your nav view this it will show the binding error on launch.

    <muxc:NavigationView PaneDisplayMode="LeftCompact">
    
    </muxc:NavigationView>

Steps to reproduce the bug

  1. Create new WinUI project
  2. Update nugets to latest versions
  3. Change MainWindow.xaml to have the above NavigationView
  4. (fix any issues of not compiling because you remove the normal button)
  5. Run and toggle the side menu to see the binding error output on the debug console (and on screen helper bar)
  6. Roll back one version to 1.4.240211001 and test again, binding issue is now gone.

Expected behavior

No binding errors.

Screenshots

N/A

NuGet package version

WinUI 3 - Windows App SDK 1.5.0: 1.5.240227000

Windows version

Windows 11 (23H2): Build 22631

Additional context

N/A

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 7
  • Comments: 16 (3 by maintainers)

Most upvoted comments

Seeing this error on MAUI when opening/closing Flyout:

Error: Converter failed to convert value of type ‘Windows.Foundation.IReference`1<Microsoft.UI.Xaml.GridLength>’ to type ‘Double’; BindingExpression: Path=‘TemplateSettings.CompactPaneGridLength’ DataItem=‘Microsoft.UI.Xaml.Controls.SplitView’; target element is ‘Microsoft.UI.Xaml.Media.Animation.SplineDoubleKeyFrame’ (Name=‘null’); target property is ‘Value’ (type ‘Double’).

Hi I’m an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

Hi, I’m using 1.5.240428000 in WinUI3 and this problem has still happened. When does 1.6 come out? Thanks

Confirmed, happens here as well still in 1.5.240311000.

I’m also seeing this if MAUI is built against WinUI 3 v1.5.240227000

The offending piece is the makrup below in the SplitView template - we are trying to bind a gridlength to translatex - which are not compatible types.

<DoubleAnimationUsingKeyFrames Storyboard.TargetName="PaneClipRectangleTransform" Storyboard.TargetProperty="TranslateX">
      <SplineDoubleKeyFrame KeyTime="{StaticResource SplitViewPaneAnimationCloseDuration}" KeySpline="0.0,0.35 0.15,1.0" Value="{Binding TemplateSettings.CompactPaneGridLength, RelativeSource={RelativeSource Mode=TemplatedParent}}" />
  </DoubleAnimationUsingKeyFrames>