Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Can not edit data on DataGrid

$
0
0

I am overriding GenerateElement and GenerateEditingElement on a DataGridTextColumn so I can insert a combo box in the cells of the first row. However, I can not edit the text in the TextBlock on the grid. Any thoughts?

public class DataColumn : DataGridTextColumn
{
     private TextBlock dataBlock {get; set;}
     protected override FrameworkElement GenerateEditingElement(DataGridCell cell, object dataItem)
      {
          return dataBlock;
      }
     protected override FrameworkElement GenerateElement(DataGridCell cell, object dataItem)
      {
          if (firstRow)
          {
             return new ComboBox();
          }
          dataBlock = new TextBlock();
          dataBlock.SetBinding(TextBlock.TextProperty, base.Binding);
          return dataBlock;
}

Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>