Skip to content

grokys/DataGridRowSelectionBinding

Repository files navigation

Synchronizing DataGrid Row Selection with the ViewModel

This repository contains an example using a XAML behavior to synchronize the selection of rows in a DataGrid with a ViewModel in WPF.

It defines a DataGridExtensions.SynchronizeSelection attached property that can be set on a DataGrid:

<DataGrid ItemsSource="{Binding Items}"
          b:DataGridExtensions.SynchronizeSelection="{Binding SelectedItem}"/>

(see MainView.axaml)

When set, the attached property will synchronize the selection of rows in the DataGrid with each bound row model. The behavior assumes that the model implements IsSelectable and hence has a boolean IsSelected property.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages