I would like to achieve the follwing via binding if possible...
I have a WPF DataGrid bound to an ObservableCollection
public class Product
{
public string Code { get; set; }
public string Desc { get; set; }
public bool Updated { get; set; }
}
My grids DataContext is is set to the observable collection.
What I would like to achieve...
I think that I will need to implement INotifyPropertyChanged to accomplish this but not certain on exactly how to do it. Additionally, is there a binding property on the grid to ensure that changes made on the UI update the backing store?
Cheers.
Your Product
class should implement INPC
so bindings to Updated
are updated.
You can additionally change the setters of all properties to set Updated
to true
.
You can trigger on the property:
<DataGrid.RowStyle> <Style TargetType="DataGridRow"> <Style.Triggers> <DataTrigger Binding="{Binding Updated}" Value="True"> <Setter Property="Background" Value="Orange"/> </DataTrigger> </Style.Triggers> </Style> </DataGrid.RowStyle>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.