开发者

WPF Binding rows of datagrid together

开发者 https://www.devze.com 2023-02-11 10:20 出处:网络
I have a class as follows class DataGridItem { public bool IsSpecial; public string Symbol; public double Weight;

I have a class as follows

class DataGridItem
{
    public bool IsSpecial;
    public string Symbol;
    public double Weight;
}

An editable datagrid is bound to a collection of objects of this class. What开发者_JS百科 I need to do is to bind several rows of the datagrid together. That is, whenever IsSpecial is true, the Weight field of all rows must be the same. If I edit one row, it has to automatically modify all other rows where IsSpecial is true. How can I do this?


You can subscribe to the CellEditEnding/RowEditEnding and the InitializingNewItem events and change all the items in there. Remember to call the PropertyChanged handlers for every property changed so the grid does update!

0

精彩评论

暂无评论...
验证码 换一张
取 消