WinUI 3 Button with a command in the Grid Row using MVVM #4758
Replies: 2 comments
-
Hello boriskleynbok, thank you for opening an issue with us! I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌 |
Beta Was this translation helpful? Give feedback.
-
@boriskleynbok this sounds like you're having issues with how x:Bind works? See also here: microsoft/microsoft-ui-xaml#2508 If Do you think this is an issue with the MVVM Toolkit or the DataGrid specifically? I'm not entirely sure what part you think is involved and is a bug here. Can you provide some more details? Thanks. |
Beta Was this translation helpful? Give feedback.
-
I would like to have a Button with a Command property with a CommandParameter in the DataGrid.
Everything in the application is following MVVM pattern with dependency injection.
When I click the button it does nothing. When I switch to the Binding instead of the x:Bind the button does nothing.
Is there a way to reference Ancestor DataContext to the Command and bind a current Item into CommandParameter?
<DataTemplate x:DataType="vm:SearchUserViewModel"> <StackPanel> <Button Command="{x:Bind EditUserCommand}"> <SymbolIcon Symbol="Edit"/> </Button> </StackPanel> </DataTemplate>
The DataGrid is bound to the ObservableCollection and the DataTemplate does not support either binding patterns.
To me this is a bug and needs to be fixed.
Beta Was this translation helpful? Give feedback.
All reactions