5

I read about x:Bind, it has better performance vs Binding. But in my application WPF C# with .NET Framework 4.8 when I put x:Bind in any part (TextBox Text="{x:Bind ...}"), Visual Studio say to me "Bind is not supported in a Windows Presentation Foundation (WPF) project."

Is not possible you x:Bind in WPF C# Application for Desktop? Or what I need to do for use it?

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
Anton Nikolayevich
  • 579
  • 1
  • 5
  • 19
  • 2
    `x:Bind` is for `UWP` apps and not `WPF`- there even is an issue on GitHub to request x:bind for wpf https://github.com/dotnet/wpf/issues/130 – Rand Random Feb 10 '20 at 15:26

3 Answers3

6

I am afraid x:Bind is currently only supported in the Universal Windows Platform (UWP) and not in WPF/.NET Framework so the error message is correct.

You can host UWP controls in a WPF app using XAML Islands but there is no way to use a compiled binding directly on a WPF dependency property.

mm8
  • 163,881
  • 10
  • 57
  • 88
6

x:Bind is now available in non-UWP, Windows 10 desktop apps with WinUI 3.

https://learn.microsoft.com/en-us/windows/apps/winui/winui3/get-started-winui3-for-desktop

x:Bind for WPF in .NET Framework and .NET Core is still not supported.

fjch1997
  • 1,518
  • 18
  • 19
3

Try my implementation of the x:Bind Markup Extension for WPF (and Xamarin Forms) https://github.com/levitali/CompiledBindings

The nuget is CompiledBindings.WPF

Vitali
  • 51
  • 2