Setting x:DataType for RelayCommand #2819
williambuchanan2
started this conversation in
General
Replies: 3 comments 9 replies
-
What IDE are you using? I see this in Rider but it is just a bug in Rider as the bindings work |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'm using Visual Studio. Below is the message I get: XamlC warning XC0045: Binding: Property "ViewOrganisationCommand" not found on "UserOrganisationDto". |
Beta Was this translation helpful? Give feedback.
2 replies
-
The <Button
Command="{Binding Source={RelativeSource AncestorType={x:Type vm:RedSixBaseVm}}, Path=ShowPostOptionsDialogCommand, x:DataType='vm:RedSixBaseVm'}"
CommandParameter="{Binding UserFeedId}">
</Button> |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to get rid of the warnings about setting x:Datatype in the xaml.
Does anyone know how I can do this with RelayCommands? As soon as I put the x:DataType on relay commands it complains that it can't find it. I assume this is due to the word 'Command' being generated on the method? The commands are in a different context to the view binding.
What I have is a view with a ContentView inside it - the warning is coming up on the content view.
The main View has a vm as it's BindingContext, but the ContentView has it's BindingContext set to a property in that vm. The content view is used in a few places so will always have the same type set as it's BindingContent, whereas the type of vm differs depending on which main view it is on (although they all have the same base class).
Below is the xaml from the main view:
All the data in the ContentView is bound to the properties of the FeedContentDto, whereas the commands are in the vm. For this reason I used RelativeSource:
Beta Was this translation helpful? Give feedback.
All reactions