2014-11-28 19 views
8

Ho un problema molto complicato. Ho provato a controllare tutto e ho lavorato per circa 6 ore su questo problema. Ma non sono riuscito a risolvere questo problema. Quindi, ecco la domanda.Comportamento imprevisto di DataGrid

Problema:

Inizialmente, quando i carichi di programma su:

enter image description here

Quando clicco sul pulsante di modifica su ogni riga:

enter image description here

Quando risparmio che riga:

enter image description here

Quando clicco sul pulsante di modifica su un altro fila avendo diversa Capogruppo:

enter image description here

XAML si presenta come di seguito:

<CollectionViewSource x:Key="GroupsViewSource" Source="{Binding Groups, UpdateSourceTrigger=PropertyChanged}"> 
    <CollectionViewSource.SortDescriptions> 
     <scm:SortDescription PropertyName="GroupName"/> 
    </CollectionViewSource.SortDescriptions> 
</CollectionViewSource> 
<CollectionViewSource x:Key="ParentGroupsViewSource" Source="{Binding ParentGroups}"> 
    <CollectionViewSource.SortDescriptions> 
     <scm:SortDescription PropertyName="GroupName"/> 
    </CollectionViewSource.SortDescriptions> 
</CollectionViewSource> 

<DataGrid Grid.Row="0" Grid.Column="0" ItemsSource="{Binding Source={StaticResource GroupsViewSource}}" 
     SelectedItem="{Binding SelectedGroup}" x:Name="dataGrid" 
     AutoGenerateColumns="False" CanUserAddRows="False" 
     SelectionMode="Single" SelectionUnit="FullRow" IsSynchronizedWithCurrentItem="True" 
     EnableRowVirtualization="False" VirtualizingPanel.IsContainerVirtualizable="False" RowEditEnding="DataGrid_RowEditEnding"> 

    <DataGrid.Resources> 
     <Style TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource {x:Type DataGridCell}}"> 
      <EventSetter Event="PreviewMouseLeftButtonDown" Handler="DataGridCell_PreviewMouseLeftButtonDown" /> 
     </Style> 
    </DataGrid.Resources> 

    <i:Interaction.Triggers> 
     <i:EventTrigger EventName="RowEditEnding"> 
      <i:InvokeCommandAction Command="{Binding DataGridRowEditEndingCommand}" /> 
     </i:EventTrigger> 
    </i:Interaction.Triggers> 

    <DataGrid.Columns> 

     <DataGridTemplateColumn Header="Group Name" Width="*" SortMemberPath="GroupName"> 
      <DataGridTemplateColumn.HeaderTemplate> 
       <DataTemplate> 
        <Grid IsHitTestVisible="True"> 
         <Grid.ColumnDefinitions> 
          <ColumnDefinition/> 
          <ColumnDefinition/> 
         </Grid.ColumnDefinitions> 
         <TextBlock Grid.Column="0" Text="{TemplateBinding Content}"/> 
         <!--FILTER EXPANDER--> 
         <Expander Grid.Column="1" IsHitTestVisible="True" VerticalAlignment="Top" Margin="30 0 0 0" ToolTip="Filter"> 
          <Border IsHitTestVisible="True" BorderThickness="1" Margin="-160 5 0 0" MinWidth="200" Height="31" > 
           <TextBox Text="{Binding DataContext.SearchGroupName, ElementName=uc, UpdateSourceTrigger=PropertyChanged}" 
            TextChanged="SearchTextBox_TextChanged" ToolTip="Enter Group Name to search" FontSize="16" BorderThickness="1" /> 
          </Border> 
         </Expander> 
        </Grid> 
       </DataTemplate> 
      </DataGridTemplateColumn.HeaderTemplate> 

      <DataGridTemplateColumn.CellTemplate> 
       <DataTemplate> 
        <TextBlock Text="{Binding GroupName}" /> 
       </DataTemplate> 
      </DataGridTemplateColumn.CellTemplate> 
      <DataGridTemplateColumn.CellEditingTemplate> 
       <DataTemplate> 
        <TextBox Text="{Binding GroupName}" /> 
       </DataTemplate> 
      </DataGridTemplateColumn.CellEditingTemplate> 
     </DataGridTemplateColumn> 

     <DataGridTemplateColumn Header="Parent Group" Width="*" SortMemberPath="ParentID"> 
      <DataGridTemplateColumn.CellTemplate> 
       <DataTemplate> 
        <TextBlock Text="{Binding ParentID, Converter={StaticResource parentIDToGroupNameConverter}}" /> 
       </DataTemplate> 
      </DataGridTemplateColumn.CellTemplate> 
      <DataGridTemplateColumn.CellEditingTemplate> 
       <DataTemplate> 
        <ComboBox ItemsSource="{Binding Source={StaticResource ParentGroupsViewSource}}" 
          DisplayMemberPath="GroupName" 
          SelectedValue="{Binding ParentID, Converter={StaticResource parentIDToGroupNameConverter}}" SelectedValuePath="GroupName"/> 
       </DataTemplate> 
      </DataGridTemplateColumn.CellEditingTemplate> 
     </DataGridTemplateColumn> 

     <DataGridTemplateColumn Header="Edit" Width="50" IsReadOnly="True"> 
      <DataGridTemplateColumn.CellTemplate> 
       <DataTemplate> 
        <Grid> 
         <Grid.RowDefinitions> 
          <RowDefinition Height="Auto" /> 
          <RowDefinition Height="Auto" /> 
         </Grid.RowDefinitions> 
         <Button x:Name="btnEdit" Style="{StaticResource ResourceKey=EditButton}" Height="35" Width="35" 
          Visibility="{Binding DataContext.IsInEdit, 
               RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}, 
               Converter={StaticResource boolToVisibilityInverseConverter}}" 
          Click="EditButton_Click" 
          Command="{Binding DataContext.EditCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}"/> 
         <Button x:Name="btnSave" Grid.Row="1" Style="{StaticResource ResourceKey=SaveButton}" Height="35" Width="35" 
          Visibility="{Binding DataContext.IsInEdit, 
               RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}, 
               Converter={StaticResource boolToVisibilityConverter}}" 
          Click="SaveButton_Click" 
          Command="{Binding DataContext.SaveCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}"/> 
        </Grid> 
       </DataTemplate> 
      </DataGridTemplateColumn.CellTemplate> 
     </DataGridTemplateColumn> 

     <DataGridTemplateColumn Header="Delete" Width="70" IsReadOnly="True"> 
      <DataGridTemplateColumn.CellTemplate> 
       <DataTemplate> 
        <Grid> 
         <Grid.RowDefinitions> 
          <RowDefinition Height="Auto" /> 
          <RowDefinition Height="Auto" /> 
         </Grid.RowDefinitions> 
         <Button x:Name="btnDelete" Style="{StaticResource ResourceKey=DeleteButton}" Height="35" Width="35" 
          Visibility="{Binding DataContext.IsInEdit, 
               RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}, 
               Converter={StaticResource boolToVisibilityInverseConverter}}" 
          Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}"/> 
         <Button x:Name="btnCancel" Grid.Row="1" Style="{StaticResource ResourceKey=CancelButton}" Height="35" Width="35" 
          Visibility="{Binding DataContext.IsInEdit, 
               RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}, 
               Converter={StaticResource boolToVisibilityConverter}}" 
          Command="{Binding DataContext.CancelCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}" 
          Click="CancelButton_Click"/> 
        </Grid> 
       </DataTemplate> 
      </DataGridTemplateColumn.CellTemplate> 
     </DataGridTemplateColumn> 

    </DataGrid.Columns> 

</DataGrid> 

Ecco il code-behind:

public partial class ListView : UserControl 
{ 
    ERPLiteDBContext db = new ERPLiteDBContext(); 

    public ListView() 
    { 
     InitializeComponent(); 
    } 

    private void DataGridCell_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) 
    { 
     DependencyObject dep = (DependencyObject)e.OriginalSource; 

     if (dep == null) 
      return; 

     while (dep != null && !(dep is DataGridCell)) 
     { 
      dep = VisualTreeHelper.GetParent(dep); 
     } 

     if (dep == null) 
      return; 

     if (dep is DataGridCell) 
     { 
      if (!((DataGridCell)dep).IsReadOnly) 
      { 
       if (!((DataGridCell)dep).IsEditing) 
        e.Handled = true; 
      } 
     } 

     while (dep != null && !(dep is DataGridRow)) 
     { 
      dep = VisualTreeHelper.GetParent(dep); 
     } 

     if (dep == null) 
      return; 

     if (dep is DataGridRow) 
     { 
      ((DataGridRow)dep).IsSelected = true; 
     } 

     while (dep != null && !(dep is DataGrid)) 
     { 
      dep = VisualTreeHelper.GetParent(dep); 
     } 

     if (dep == null) 
      return; 

     if (dep is DataGrid) 
     { 
      ((DataGrid)dep).Focus(); 
     } 
    } 

    private void EditButton_Click(object sender, RoutedEventArgs e) 
    { 
     int rowIndex = 0; 

     DependencyObject dep = (DependencyObject)e.OriginalSource; 
     while (dep != null && !(dep is DataGridCell)) 
     { 
      dep = VisualTreeHelper.GetParent(dep); 
     } 

     if (dep == null) 
      return; 
     DataGridRow row = null; 
     if (dep is DataGridCell) 
     { 
      while (dep != null && !(dep is DataGridRow)) 
      { 
       dep = VisualTreeHelper.GetParent(dep); 
      } 

      row = (DataGridRow)dep; 
      rowIndex = FindRowIndex(row); 
     } 

     while (dep != null && !(dep is DataGrid)) 
     { 
      dep = VisualTreeHelper.GetParent(dep); 
     } 

     if (dep == null) 
      return; 

     DataGrid dg = (DataGrid)dep; 

     dg.CurrentCell = new DataGridCellInfo(dg.Items[rowIndex], dg.Columns[0]); 
     dg.BeginEdit(); 

     for (int column = 0; column <= dg.Columns.Count - 1; column++) 
     { 
      if (!(GetDataGridCell(new DataGridCellInfo(dg.Items[rowIndex], dg.Columns[column])).IsReadOnly)) 
      { 
       GetDataGridCell(new DataGridCellInfo(dg.Items[rowIndex], dg.Columns[column])).IsEditing = true; 
      } 
     } 

     var rows = GetDataGridRows(dg); 

     foreach (DataGridRow r in rows) 
     { 
      if (!(r.IsEditing)) 
      { 
       r.IsEnabled = false; 
      } 
     } 
    } 

    private void SaveButton_Click(object sender, RoutedEventArgs e) 
    { 
     int rowIndex = 0; 

     DependencyObject dep = (DependencyObject)e.OriginalSource; 
     while (dep != null && !(dep is DataGridCell)) 
     { 
      dep = VisualTreeHelper.GetParent(dep); 
     } 

     if (dep == null) 
      return; 

     DataGridRow row = null; 

     if (dep is DataGridCell) 
     { 

      while (dep != null && !(dep is DataGridRow)) 
      { 
       dep = VisualTreeHelper.GetParent(dep); 
      } 

      row = (DataGridRow)dep; 
      rowIndex = FindRowIndex(row); 

     } 

     while (dep != null && !(dep is DataGrid)) 
     { 
      dep = VisualTreeHelper.GetParent(dep); 
     } 

     if (dep == null) 
      return; 

     DataGrid dg = (DataGrid)dep; 

     dg.CommitEdit(DataGridEditingUnit.Row, true); 

     for (int column = 0; column <= dg.Columns.Count - 1; column++) 
     { 
      if (!(GetDataGridCell(new DataGridCellInfo(dg.Items[rowIndex], dg.Columns[column])).IsReadOnly)) 
      { 
       GetDataGridCell(new DataGridCellInfo(dg.Items[rowIndex], dg.Columns[column])).IsEditing = false; 
      } 
     } 

     var rows = GetDataGridRows(dg); 

     foreach (DataGridRow r in rows) 
     { 
      r.IsEnabled = true; 
     } 
    } 

    private void CancelButton_Click(object sender, RoutedEventArgs e) 
    { 
     DependencyObject dep = (DependencyObject)e.OriginalSource; 

     int rowIndex = 0; 

     DataGridRow row = null; 

     while (dep != null && !(dep is DataGridRow)) 
     { 
      dep = VisualTreeHelper.GetParent(dep); 
     } 

     row = (DataGridRow)dep; 
     rowIndex = FindRowIndex(row); 

     while (dep != null && !(dep is DataGrid)) 
     { 
      dep = VisualTreeHelper.GetParent(dep); 
     } 

     if (dep == null) 
      return; 

     DataGrid dg = (DataGrid)dep; 

     var rows = GetDataGridRows(dg); 

     dg.CancelEdit(DataGridEditingUnit.Row); 

     for (int column = 0; column <= dg.Columns.Count - 1; column++) 
     { 
      if (!(GetDataGridCell(new DataGridCellInfo(dg.Items[rowIndex], dg.Columns[column])).IsReadOnly)) 
      { 
       GetDataGridCell(new DataGridCellInfo(dg.Items[rowIndex], dg.Columns[column])).IsEditing = false; 
      } 
     } 

     foreach (DataGridRow r in rows) 
     { 
      r.IsEnabled = true; 
     } 
    } 

    private void DataGrid_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e) 
    { 
     DataGrid dg = (DataGrid)sender; 
     foreach (DataGridRow row in GetDataGridRows(dg)) 
     { 
      row.IsEnabled = true; 
     } 
    } 

    private void SearchTextBox_TextChanged(object sender, TextChangedEventArgs e) 
    { 
     if (dataGrid.SelectedItem != null) 
     { 
      dataGrid.ScrollIntoView(dataGrid.SelectedItem); 
     } 
    } 

    public DataGridCell GetDataGridCell(DataGridCellInfo cellInfo) 
    { 
     var cellContent = cellInfo.Column.GetCellContent(cellInfo.Item); 
     if (cellContent != null) 
      return (DataGridCell)cellContent.Parent; 

     return null; 
    } 

    private int FindRowIndex(DataGridRow row) 
    { 
     DataGrid dataGrid = ItemsControl.ItemsControlFromItemContainer(row) as DataGrid; 

     int index = dataGrid.ItemContainerGenerator.IndexFromContainer(row); 

     return index; 
    } 

    public IEnumerable<DataGridRow> GetDataGridRows(DataGrid grid) 
    { 
     var itemsSource = grid.ItemsSource as IEnumerable; 
     if (null == itemsSource) yield return null; 
     foreach (var item in itemsSource) 
     { 
      var row = grid.ItemContainerGenerator.ContainerFromItem(item) as DataGridRow; 
      if (null != row) yield return row; 
     } 
    } 
} 

At Last qui è il codice per ViewModel:

public class ListViewModel : ViewModelBase 
{ 
    ERPLiteDBContext db = new ERPLiteDBContext(); 

    public ListViewModel() 
    { 
     Groups = new ObservableCollection<Group>(db.Groups); 
     ParentGroups = new ObservableCollection<Group>(db.Groups); 

     EditCommand = new RelayCommand(Edit); 
     SaveCommand = new RelayCommand(Save); 
     DeleteCommand = new RelayCommand(Delete); 
     CancelCommand = new RelayCommand(Cancel); 
     DataGridRowEditEndingCommand = new RelayCommand(DataGridRowEditEnding); 

     SearchGroupName = ""; 
     IsInEdit = false; 
    } 

    public RelayCommand EditCommand { get; set; } 
    public RelayCommand SaveCommand { get; set; } 
    public RelayCommand DeleteCommand { get; set; } 
    public RelayCommand CancelCommand { get; set; } 
    public RelayCommand DataGridRowEditEndingCommand { get; set; } 

    private string _searchGroupName; 
    public string SearchGroupName 
    { 
     get 
     { 
      return _searchGroupName; 
     } 
     set 
     { 
      if (value == null) 
      { 
       SearchGroupName = ""; 
      } 
      else 
      { 
       _searchGroupName = value; 
      } 

      OnPropertyChanged("SearchGroupName"); 

      SelectedGroup = db.Groups.AsEnumerable().OrderBy(x => x.GroupName).Where(x => x.GroupName.StartsWith(SearchGroupName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); 

      if (SelectedGroup == null) 
      { 
       SelectedGroup = db.Groups.AsEnumerable().OrderBy(x => x.GroupName).Where(x => x.GroupName.Contains(SearchGroupName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); 
      } 

     } 
    } 

    private ObservableCollection<Group> _groups; 
    public ObservableCollection<Group> Groups 
    { 
     get 
     { 
      return _groups; 
     } 
     set 
     { 
      _groups = value; 
      OnPropertyChanged("Groups"); 
     } 
    } 

    private Group _selectedGroup; 
    public Group SelectedGroup 
    { 
     get 
     { 
      return _selectedGroup; 
     } 
     set 
     { 
      _selectedGroup = value; 
      OnPropertyChanged("SelectedGroup"); 

      if (value != null) 
      { 
       ParentGroups = new ObservableCollection<Group>(db.Groups.Where(x => x.GroupID != value.GroupID)); 
       ParentGroups.Add(new Group { GroupID = -1, GroupName = "Primary" }); 
      } 
     } 
    } 

    private ObservableCollection<Group> _parentGroups; 
    public ObservableCollection<Group> ParentGroups 
    { 
     get 
     { 
      return _parentGroups; 
     } 
     set 
     { 
      _parentGroups = value; 
      OnPropertyChanged("ParentGroups"); 
     } 
    } 

    private Group _selectedParentGroup; 
    public Group SelectedParentGroup 
    { 
     get 
     { 
      return _selectedParentGroup; 
     } 
     set 
     { 
      _selectedParentGroup = value; 
      OnPropertyChanged("SelectedParentGroup"); 
     } 
    } 

    private bool _isInEdit; 
    public bool IsInEdit 
    { 
     get 
     { 
      return _isInEdit; 
     } 
     set 
     { 
      _isInEdit = value; 
      OnPropertyChanged("IsInEdit"); 
     } 
    } 

    private void Edit(object obj) 
    { 
     IsInEdit = true; 
    } 

    private void Save(object obj) 
    { 
     IsInEdit = false; 
     SaveToDataBase(); 
    } 

    private void Delete(object obj) 
    { 

    } 

    private void Cancel(object obj) 
    { 
     IsInEdit = false; 
    } 

    private void DataGridRowEditEnding(object obj) 
    { 
     IsInEdit = false; 
    } 

    public void SaveToDataBase() 
    { 
     Group currentGroup = db.Groups.Where(x => x.GroupID == SelectedGroup.GroupID).FirstOrDefault(); 
     if (currentGroup != null) 
     { 
      currentGroup.GroupName = SelectedGroup.GroupName; 
      if (SelectedGroup.ParentID == -1) 
      { 
       currentGroup.ParentID = null; 
      } 
      else 
      { 
       currentGroup.ParentID = SelectedGroup.ParentID; 
      } 

      db.SaveChanges(); 
     } 
    } 
} 

non sono sicuro dove sta il problema, quindi, ho postato quasi tutto il codice qui.

ho creato un progetto di esempio che può essere scaricato dal link sottostante:

Progetto:

https://drive.google.com/file/d/0B5WyqSALui0bTTNsMm5ISHV3VEk/view?usp=sharing

DataBase:

https://drive.google.com/file/d/0B5WyqSALui0bTXVJanp4TE9iSGs/view?usp=sharing

Edit 1:

Il problema originale (come mostrato nelle immagini) è risolto

Per risolvere il problema ho rimosso CollectionViewSource e vincolata ComboBox direttamente al ViewModel Proprietà. Ora ottengo un altro errore:

enter image description here

Quando vedo InnerException:

enter image description here

ho cercato la rete per questo errore, ma poi ovunque posso vedere che se inserisco il valore NULL in la colonna Chiave esterna quindi ottengo questo errore. Ma la mia colonna è Nullable e ho bisogno di null da inserire.

Edit 2:

ho risolto l'errore descritto nella modifica 1.

Aggiunto un nuovo record come primo record della tabella chiamata primaria. E rimosso tutta la codifica relativa al gruppo primario. Sostituito NULL nel database con il gruppo principale.

Ora l'unico problema rimasto è l'utilizzo di CollectionViewSource come origine di combobox per ordinare i dati invece di collegare la casella combinata direttamente alla proprietà all'interno di ViewModel. Qualcuno può rispondere a questa domanda ????

+1

Può comprimere il progetto e caricarlo su DropBox? ciò farebbe risparmiare un po 'di tempo a coloro che vogliono fare il debugging. – kennyzx

+0

Puoi preparare [mcve] (http://stackoverflow.com/help/mcve)? È persino meglio del debugging. Durante la preparazione di questo esempio, ripeterai tutti i passaggi e, se il problema persiste, è un buon segno che non puoi ripararlo. Ma più spesso, lo risolverai trovando qualcosa * insolito * o * anormale *. – Sinatr

+0

@kennyzx Ho caricato il mio progetto e il mio database su google drive. Ho aggiornato la mia domanda con i collegamenti per scaricarla. – Vishal

risposta

3

Il problema è risolto. Vedere Modifica 1 e Modifica 2 in questione per metà della soluzione.

Dopo modifica 2 Non ero in grado di ordinare i dati in ComboBox utilizzando CollectionViewSource. Quindi, ho usato OrderBy nella mia domanda. Ora i dati in ComboBox sono ordinati come previsto. Ora, la mia domanda si presenta come:

ParentGroups = new ObservableCollection<Group>(db.Groups.OrderBy(x => x.GroupName)); 

Ora il DataGrid funziona come previsto.

Ho postato questa soluzione perché penso che potrebbe aiutare qualcuno in futuro.

Grazie a tutti si sono interessati a risolvere il mio problema.

Qui potete trovare l'esempio di lavoro:

Progetto: https://drive.google.com/file/d/0B5WyqSALui0beC05VnpMY1hzV3c/view?usp=sharing

Database: https://drive.google.com/file/d/0B5WyqSALui0bTXVJanp4TE9iSGs/view?usp=sharing

3

Stai miscelando Commands e gestori di eventi - mai una buona idea. Credo di capire quello che stai cercando di fare. Questa sarà la pura soluzione MVVM senza route di gestori di eventi.

Prima di iniziare, si presume che lo DataGrid sia associato a uno ObservableCollection di ViewModel oggetti che rappresentano le singole righe. Questo risolve molti problemi e complessità con gli accoppiamenti agli oggetti parent ViewModel come al momento presenti in XAML e semplifica l'implementazione di per riga Commands (perché i dati e il comando sono incapsulati all'interno della stessa classe se si utilizza DelegateCommand - come stai usando PRISM. Presumo che tu lo stia usando ovunque).

In primo luogo è necessario aggiungere uno stile per la proprietà DataGridCell.IsEditing per associarlo a una proprietà booleana IsEditing su ViewModel. Cambia il pulsante Modifica per associare a Command che impostasulla riga ViewModel a true - la griglia deve reagire andando in modalità Modifica.

È possibile prendere in considerazione l'associazione dei modelli di modifica a Modifica valori specifici in modo da non sovrascrivere i dati originali in caso di annullamento della modifica. Ricorda anche di impostare la rilegatura a Mode=TwoWay con UpdateSourceTrigger=PropertyChanged

È quindi possibile aggiungere Interazione evento a comandare mapper ai vari controlli di modifica del modello in modo tale che se si ha colpito Inserisci che richiama il SaveCommand e termina la modalità di modifica impostando IsEditing sul tuo ViewModel torna a falso.

+0

Grazie per l'ottima risposta. Cerco sempre di utilizzare il pattern MVVM laddove possibile. In alcuni casi, non so come usare ViewModels come mettere un'intera riga in modalità di modifica invece di una cella, lì utilizzo l'approccio code behind. Così ho mescolato i due: MVVM e code-behind. Ora, vorrei chiederti 1 cosa. Cosa intendi con dovrei aggiungere uno stile per DataGridRow.IsEditing? Perché dovrei usare quello stile? e come dovrei creare e usare quello stile? Puoi per favore mostrarmi un esempio di codice o qualche link? – Vishal

+0

Ci scusiamo, sembra che mi fossi sbagliato sul fatto che 'IsEditing' fosse associabile su DataGridRow - Ho visto la proprietà di dipendenza sulla classe e fatto un'ipotesi. Dovrai vincolarlo in uno stile a un livello 'DataGridCell'. Aggiornerò la mia risposta ... – toadflakz

+0

Sono davvero un principiante con 5-6 mesi di esperienza in WPF e XAML. Puoi indicarmi un tutorial o domande su stackoverflow.com? – Vishal

Problemi correlati