Quantcast
Channel: Rhino Developer - McNeel Forum
Viewing all articles
Browse latest Browse all 8532

ComboBoxCell binding

$
0
0

@sarg wrote:

Anyone have an example of property binding for a ComboBoxCell? I have a constant list of possible string values, and I’m trying to bind the actual value to a class property (e.g. below). (As an aside, what I really want is a dropdown (not a combobox), but I don’t see this option for cells.)

public class MyItem : TreeGridItem
{
   public string Value { get; set; }
}

public class MyTree : TreeGridView
{
   public MyTree
   {
      var cbox = new ComboBoxCell 
      { 
          DataStore = new List<string> { "val 1", "val 2", "val 3" },
          // how to bind selected value to MyItem.Value?
      };
      var column = new GridColumn 
      { 
          Editable = true, 
          DataCell = cbox 
      };
      Columns.Add(column);

      var collection = new TreeGridItemCollection();
      collection.Add(new MyItem { Value = "val 2" });
   }
}

Thanks,

Jon

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 8532

Trending Articles