Fixing binding issues XC0045 introduced with .net9 upgrade #2374
Unanswered
BeepBeepBopBop
asked this question in
Q&A
Replies: 1 comment
-
You need to change to something like: <ui:ChatSettingsView
x:Name="settingsSidebar"
Grid.Row="1"
Grid.Column="2"
WidthRequest="{Binding Source={RelativeSource AncestorType={x:Type ui:ChatPage}},Path=SettingsSidebarWidth, x:DataType=ui:ChatPage}"
BindingContext="{Binding SettingsViewModel}"/>
.NET 9.0 brings in a requirement to use compiled bindings to make apps trim safe. You now need to tell the compiler what type the source of the binding is, which is what the above should do |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone, we have recently upgraded a project from .net8 and .net 9 and now have warnings that we did not have before.
Specifically warning XC0045.
I have included an example, taken from a ContentView code file:
Binding: Property "SettingsSidebarWidth" not found on "App.ViewModels.ChatPageViewModel".
Note that the ContentView has x:DataType="vm:ChatPageViewModel" and that ChatPage is the parent page, which is what I am successfully binding to. MAUI somehows thinks I am trying to bind to ChatPageViewModel though.
So what would be the new expected syntax in this scenario ? Thanks for any input
Beta Was this translation helpful? Give feedback.
All reactions