Example #1
0
        /// <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);
        }
Example #2
0
        /// <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);
        }
Example #3
0
        /// <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;
        }
Example #4
0
 /// <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));
 }
Example #5
0
 /// <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));
 }
Example #6
0
 /// <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));
 }
Example #7
0
        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];
        }
Example #8
0
 /// <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;
 }