/// <summary>
        /// Creates a check box control with data binding.
        /// </summary>
        /// <param name="d">The cell definition.</param>
        /// <returns>
        /// A CheckBox.
        /// </returns>
        protected virtual FrameworkElement CreateCheckBoxControl(CellDefinition d)
        {
            if (d.IsReadOnly)
            {
                var cm = new CheckMark
                {
                    VerticalAlignment   = VerticalAlignment.Center,
                    HorizontalAlignment = d.HorizontalAlignment,
                };
                cm.SetBinding(CheckMark.IsCheckedProperty, this.CreateBinding(d));
                this.SetBackgroundBinding(d, cm);
                return(cm);
            }

            var c = new CheckBox
            {
                VerticalAlignment   = VerticalAlignment.Center,
                HorizontalAlignment = d.HorizontalAlignment
            };

            c.SetBinding(ToggleButton.IsCheckedProperty, this.CreateBinding(d));
            this.SetIsEnabledBinding(d, c);
            this.SetBackgroundBinding(d, c);
            return(c);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates the checkbox control.
        /// </summary>
        /// <param name="property">The property.</param>
        /// <returns>
        /// The control.
        /// </returns>
        protected virtual FrameworkElement CreateBoolControl(PropertyItem property)
        {
            if (property.Descriptor.IsReadOnly())
            {
                var cm = new CheckMark
                {
                    VerticalAlignment   = VerticalAlignment.Center,
                    HorizontalAlignment = HorizontalAlignment.Left
                };
                cm.SetBinding(CheckMark.IsCheckedProperty, property.CreateBinding());
                return(cm);
            }

            var c = new CheckBox
            {
                VerticalAlignment   = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Left
            };

            c.SetBinding(ToggleButton.IsCheckedProperty, property.CreateBinding());
            return(c);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a check box control with data binding.
        /// </summary>
        /// <param name="propertyDefinition">The property definition.</param>
        /// <param name="bindingPath">The binding path.</param>
        /// <returns>
        /// A CheckBox.
        /// </returns>
        protected virtual FrameworkElement CreateCheckBoxControl(PropertyDefinition propertyDefinition, string bindingPath)
        {
            if (propertyDefinition.IsReadOnly)
            {
                var cm = new CheckMark
                {
                    VerticalAlignment   = VerticalAlignment.Center,
                    HorizontalAlignment = propertyDefinition.HorizontalAlignment
                };
                cm.SetBinding(CheckMark.IsCheckedProperty, propertyDefinition.CreateBinding(bindingPath));
                return(cm);
            }

            var c = new CheckBox
            {
                VerticalAlignment   = VerticalAlignment.Center,
                HorizontalAlignment = propertyDefinition.HorizontalAlignment,
                IsEnabled           = !propertyDefinition.IsReadOnly
            };

            c.SetBinding(ToggleButton.IsCheckedProperty, propertyDefinition.CreateBinding(bindingPath));
            return(c);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates a check box control.
        /// </summary>
        /// <param name="d">
        /// The definition.
        /// </param>
        /// <param name="index">
        /// The index.
        /// </param>
        /// <returns>
        /// A CheckBox.
        /// </returns>
        protected virtual FrameworkElement CreateCheckBoxControl(PropertyDefinition d, int index)
        {
            if (d.IsReadOnly)
            {
                var cm = new CheckMark
                            {
                                VerticalAlignment = VerticalAlignment.Center,
                                HorizontalAlignment = d.HorizontalAlignment
                            };
                cm.SetBinding(CheckMark.IsCheckedProperty, d.CreateBinding(index));
                return cm;
            }

            var c = new CheckBox
                {
                    VerticalAlignment = VerticalAlignment.Center,
                    HorizontalAlignment = d.HorizontalAlignment,
                    IsEnabled = !d.IsReadOnly
                };
            c.SetBinding(ToggleButton.IsCheckedProperty, d.CreateBinding(index));
            return c;
        }
        /// <summary>
        /// Creates a check box control with data binding.
        /// </summary>
        /// <param name="d">The cell definition.</param>
        /// <returns>
        /// A CheckBox.
        /// </returns>
        protected virtual FrameworkElement CreateCheckBoxControl(CellDefinition d)
        {
            if (d.IsReadOnly)
            {
                var cm = new CheckMark
                {
                    VerticalAlignment = VerticalAlignment.Center,
                    HorizontalAlignment = d.HorizontalAlignment,
                };
                cm.SetBinding(CheckMark.IsCheckedProperty, this.CreateBinding(d));
                this.SetBackgroundBinding(d, cm);
                return cm;
            }

            var c = new CheckBox
            {
                VerticalAlignment = VerticalAlignment.Center,
                HorizontalAlignment = d.HorizontalAlignment
            };
            c.SetBinding(ToggleButton.IsCheckedProperty, this.CreateBinding(d));
            this.SetIsEnabledBinding(d, c);
            this.SetBackgroundBinding(d, c);
            return c;
        }
        /// <summary>
        /// Creates the checkbox control.
        /// </summary>
        /// <param name="property">The property.</param>
        /// <returns>
        /// The control.
        /// </returns>
        protected virtual FrameworkElement CreateBoolControl(PropertyItem property)
        {
            if (property.Descriptor.IsReadOnly())
            {
                var cm = new CheckMark
                {
                    VerticalAlignment = VerticalAlignment.Center,
                    HorizontalAlignment = HorizontalAlignment.Left
                };
                cm.SetBinding(CheckMark.IsCheckedProperty, property.CreateBinding());
                return cm;
            }

            var c = new CheckBox
                {
                    VerticalAlignment = VerticalAlignment.Center,
                    HorizontalAlignment = HorizontalAlignment.Left
                };

            c.SetBinding(ToggleButton.IsCheckedProperty, property.CreateBinding());
            return c;
        }
        /// <summary>
        /// Creates a check box control with data binding.
        /// </summary>
        /// <param name="propertyDefinition">The property definition.</param>
        /// <param name="bindingPath">The binding path.</param>
        /// <returns>
        /// A CheckBox.
        /// </returns>
        protected virtual FrameworkElement CreateCheckBoxControl(PropertyDefinition propertyDefinition, string bindingPath)
        {
            if (propertyDefinition.IsReadOnly)
            {
                var cm = new CheckMark
                             {
                                 VerticalAlignment = VerticalAlignment.Center,
                                 HorizontalAlignment = propertyDefinition.HorizontalAlignment
                             };
                cm.SetBinding(CheckMark.IsCheckedProperty, propertyDefinition.CreateBinding(bindingPath));
                return cm;
            }

            var c = new CheckBox
                        {
                            VerticalAlignment = VerticalAlignment.Center,
                            HorizontalAlignment = propertyDefinition.HorizontalAlignment,
                            IsEnabled = !propertyDefinition.IsReadOnly
                        };
            c.SetBinding(ToggleButton.IsCheckedProperty, propertyDefinition.CreateBinding(bindingPath));
            return c;
        }