// bindings public void SetListModel(ParticleConduitListViewModel listModel) { _model_list = listModel; // set up bindings for grid view _gV_ParticleSystems.DataContext = _model_list; _gV_ParticleSystems.DataStore = _model_list.Conduits; _gV_ParticleSystems.SelectedItemBinding.BindDataContext((ParticleConduitListViewModel avm) => avm.SelectedIndex); // redraw _gV_ParticleSystems.Invalidate(); }
public ParticleSystemManager(uint documentSerialNumber) { _document_sn = documentSerialNumber; // set up grid vies _gV_ParticleSystems.ShowHeader = true; _model_list = RhinoFaceMePlugIn.Instance.FaceMeTable; // set up bindings for grid view _gV_ParticleSystems.DataContext = _model_list; _gV_ParticleSystems.DataStore = _model_list.Conduits; _gV_ParticleSystems.SelectedItemBinding.BindDataContext((ParticleConduitListViewModel avm) => avm.SelectedIndex); // set up events for grid view _gV_ParticleSystems.CellClick += On_CellClick; #region Grid Columns // name _gV_ParticleSystems.Columns.Add(new GridColumn { HeaderText = "Name", DataCell = new TextBoxCell("Name"), Editable = false, }); // image _gV_ParticleSystems.Columns.Add(new GridColumn { HeaderText = "Image", DataCell = new ImageViewCell { Binding = Binding.Property <ParticleConduitModel, Image>( l => new System.Drawing.Bitmap(l.Bitmap.GetThumbnailImage(50, 50, null, IntPtr.Zero)).ToEto()) }, Editable = true }); // active _gV_ParticleSystems.Columns.Add(new GridColumn { HeaderText = "Active", DataCell = new CheckBoxCell("IsActive"), Editable = true, }); // size _gV_ParticleSystems.Columns.Add(new GridColumn { HeaderText = "Size", DataCell = new TextBoxCell("Size"), Editable = true, }); // color var bitmapSize = 12; _gV_ParticleSystems.Columns.Add(new GridColumn { DataCell = new ImageViewCell { Binding = Binding.Property <ParticleConduitModel, Image>(l => new Bitmap(bitmapSize, bitmapSize, PixelFormat.Format24bppRgb, from index in Enumerable.Repeat(0, bitmapSize * bitmapSize) select l.Color.ToEto())) }, HeaderText = "Color", Editable = true }); // alignment _gV_ParticleSystems.Columns.Add(new GridColumn { HeaderText = "Alignment", DataCell = new AlignmentCell(), Editable = true, }); #endregion // write layout var layout = new DynamicLayout(); layout.Padding = 10; layout.Spacing = new Size(5, 5); layout.Add(_gV_ParticleSystems); layout.Add(null); Content = layout; }