Skip to content

WinUI 3 Button with a command in the Grid Row using MVVMΒ #4746

@boriskleynbok

Description

@boriskleynbok

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions