/// <summary> /// Adds a row at the specified index within the grid. /// </summary> /// <param name="index">Index to insert the row at.</param> /// <param name="model">The model to bind to the new row.</param> /// <param name="bindingMode">How to bind the model to the new row.</param> /// <returns>The newly created row.</returns> public GridRowViewModel InsertRow(int index, ModelBase model, ModelBindingMode bindingMode = ModelBindingMode.Committed) { var row = new GridRowViewModel(model, Columns, bindingMode); Rows.Insert(index, row); return(row); }
/// <summary> /// Adds a row to the end of the grid. /// </summary> /// <param name="model">The model to bind to the new row.</param> /// <param name="bindingMode">How to bind the model to the new row.</param> /// <returns>The newly created row.</returns> public GridRowViewModel AddRow(ModelBase model, ModelBindingMode bindingMode = ModelBindingMode.Committed) { var row = new GridRowViewModel(model, Columns, bindingMode); Rows.Add(row); return(row); }
/// <param name="source">Source object.</param> /// <param name="sourceProperty">Property to bind to on source object.</param> /// <param name="mode">When to synchronize data.</param> public ModelBinding(ModelBase source, ModelProperty sourceProperty, ModelBindingMode mode) { if (source == null) { throw new ArgumentNullException("source"); } if (sourceProperty == null) { throw new ArgumentNullException("sourceProperty"); } Source = source; SourceProperty = sourceProperty; Mode = mode; }
/// <summary> /// Binds the ViewModel to a source model. /// </summary> /// <param name="source">Model to bind to.</param> /// <param name="property">Property on model to bind to.</param> /// <param name="mode">How to bind to the source model.</param> public void BindSecretText(ModelBase source, ModelProperty property, ModelBindingMode mode = ModelBindingMode.Committed) { SetBinding(SecretTextProperty, new ModelBinding(source, property, mode)); }
/// <summary> /// Binds the ViewModel to a source model. /// </summary> /// <param name="source">Model to bind to.</param> /// <param name="property">Property on model to bind to.</param> /// <param name="mode">How to bind to the source model.</param> public void BindDate(ModelBase source, ModelProperty property, ModelBindingMode mode = ModelBindingMode.Committed) { SetBinding(DateProperty, new ModelBinding(source, property, mode)); }
/// <summary> /// Binds the ViewModel to a source model. /// </summary> /// <param name="source">Model to bind to.</param> /// <param name="property">Property on model to bind to.</param> /// <param name="mode">How to bind to the source model.</param> public void BindSelection(ModelBase source, ModelProperty property, ModelBindingMode mode = ModelBindingMode.Committed) { SetBinding(SelectedIdProperty, new ModelBinding(source, property, mode)); }
internal GridRowViewModel(ModelBase model, IEnumerable <GridColumnDefinition> columns, ModelBindingMode bindingMode) { Model = model; int count = 0; foreach (var column in columns) { SetBinding(column.SourceProperty, new ModelBinding(model, column.SourceProperty, bindingMode)); count++; } Cells = new FieldViewModelBase[count]; }
/// <param name="source">Source object.</param> /// <param name="sourceProperty">Property to bind to on source object.</param> /// <param name="mode">When to synchronize data.</param> /// <param name="converter">Maps data to and from the source property.</param> public ModelBinding(ModelBase source, ModelProperty sourceProperty, ModelBindingMode mode, IConverter converter) : this(source, sourceProperty, mode) { Converter = converter; }