I have a datagrid source attribute of ObservableCollection, when I change something from the collection, the collection changes but the view does not show until I click on the line. What is the problem?
<DataGrid CanUserResizeRows="True" RowHeight="32" SelectionUnit="FullRow" SelectionMode="Extended" Grid.Row="2" Background="White" ItemsSource="{Binding Configs, UpdateSourceTrigger=PropertyChanged}" AutoGenerateColumns="False" ColumnHeaderStyle="{DynamicResource DataGridColumnHeaderStyle}"> <DataGridTextColumn Header="Description" Binding="{Binding Path=Description, UpdateSourceTrigger=PropertyChanged}" Width="*"/> MVVM
private ObservableCollection<Config> _configs = new ObservableCollection<Config>(); public ObservableCollection<Config> Configs { get { return _configs; } set { _configs = value; OnPropertyChanged("Configs"); } }
textBox1.Text = "111";or something like that, the maximum is a DataContext, then work with data, collections and other things is simple, we don’t touch View !. Well, make sure that each VM / M is responsible only for its one thing. Let's say the bus, people on the bus. Here is a bus - a separate object that contains other objects (motor, wheels, people, etc.). People are another object, with their objects and functions. But with such a distinction you have nothing special to break. - EvgeniyZ