Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. DataGrid Built In ViewModel Question

DataGrid Built In ViewModel Question

Scheduled Pinned Locked Moved WPF
question
2 Posts 2 Posters 26 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kevin Marois
    wrote on last edited by
    #1

    I'm building and populating a DataGrid in a viewmodel. Here's what I'm making[^] The two columns on the right, AutoAdjustment and AutoPosting, are combo boxes where the user can selecte 'Y' or 'N'. These are the only editable columns. For my source data, I have a list of objects called ProcoessingOutputEntries, each with a list of column objects. It's basically a 'row' object with a dynamic collection of columns on it:

    private List _ProcesssingOutputEntries;
    public List ProcesssingOutputEntries
    {
    get { return _ProcesssingOutputEntries; }
    set
    {
    if (_ProcesssingOutputEntries != value)

        {
            \_ProcesssingOutputEntries = value;
            RaisePropertyChanged(nameof(ProcesssingOutputEntries));
        }
    }
    

    }

    and

    public class ProcessingOutputEntryEntity : _EntityBase
    {
    private List _ProcesssingOutputColumns;
    public List ProcesssingOutputColumns
    {
    get { return _ProcesssingOutputColumns; }
    set
    {
    if (_ProcesssingOutputColumns != value)
    {
    _ProcesssingOutputColumns = value;
    RaisePropertyChanged(nameof(ProcesssingOutputColumns));
    }
    }
    }
    }

    and

    public class ColumnInfoEntity : _EntityBase
    {
    private string _ColumnName;
    public string ColumnName
    {
    get { return _ColumnName; }
    set
    {
    if (_ColumnName != value)
    {
    _ColumnName = value;
    RaisePropertyChanged(nameof(ColumnName));
    }
    }
    }

    private ColumnSources \_ColumnSource;
    public ColumnSources ColumnSource
    {
        get { return \_ColumnSource; }
        set
        {
            if (\_ColumnSource != value)
            {
                \_ColumnSource = value;
                RaisePropertyChanged(nameof(ColumnSource));
            }
        }
    }
    
    private ColumnTypes \_ColumnType;
    public ColumnTypes ColumnType
    {
        get { return \_ColumnType; }
        set
        {
            if (\_ColumnType != value)
            {
                \_ColumnType = value;
    
    M 1 Reply Last reply
    0
    • K Kevin Marois

      I'm building and populating a DataGrid in a viewmodel. Here's what I'm making[^] The two columns on the right, AutoAdjustment and AutoPosting, are combo boxes where the user can selecte 'Y' or 'N'. These are the only editable columns. For my source data, I have a list of objects called ProcoessingOutputEntries, each with a list of column objects. It's basically a 'row' object with a dynamic collection of columns on it:

      private List _ProcesssingOutputEntries;
      public List ProcesssingOutputEntries
      {
      get { return _ProcesssingOutputEntries; }
      set
      {
      if (_ProcesssingOutputEntries != value)

          {
              \_ProcesssingOutputEntries = value;
              RaisePropertyChanged(nameof(ProcesssingOutputEntries));
          }
      }
      

      }

      and

      public class ProcessingOutputEntryEntity : _EntityBase
      {
      private List _ProcesssingOutputColumns;
      public List ProcesssingOutputColumns
      {
      get { return _ProcesssingOutputColumns; }
      set
      {
      if (_ProcesssingOutputColumns != value)
      {
      _ProcesssingOutputColumns = value;
      RaisePropertyChanged(nameof(ProcesssingOutputColumns));
      }
      }
      }
      }

      and

      public class ColumnInfoEntity : _EntityBase
      {
      private string _ColumnName;
      public string ColumnName
      {
      get { return _ColumnName; }
      set
      {
      if (_ColumnName != value)
      {
      _ColumnName = value;
      RaisePropertyChanged(nameof(ColumnName));
      }
      }
      }

      private ColumnSources \_ColumnSource;
      public ColumnSources ColumnSource
      {
          get { return \_ColumnSource; }
          set
          {
              if (\_ColumnSource != value)
              {
                  \_ColumnSource = value;
                  RaisePropertyChanged(nameof(ColumnSource));
              }
          }
      }
      
      private ColumnTypes \_ColumnType;
      public ColumnTypes ColumnType
      {
          get { return \_ColumnType; }
          set
          {
              if (\_ColumnType != value)
              {
                  \_ColumnType = value;
      
      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      Probably an unwanted comment but why not use a checkbox binding directly to the datasource, less clicks for the user, and no faffing around with combobox and dodgy binding. You could even add the Yes/No based on the checked state.

      Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups