Ejemplo n.º 1
0
        /// <summary>
        /// Generate default parts.
        /// </summary>
        /// <param name="defaultItems"></param>
        protected override void GenerateDefaultItems(ActiproSoftware.Windows.Controls.Editors.Primitives.SlottedItemCollection defaultItems)
        {
            base.GenerateDefaultItems(defaultItems);

            DecimalPart part = new DecimalPart();

            part.SetBinding(DecimalPart.IsEditableProperty, new Binding("IsReadOnly")
            {
                Source = this, Converter = new NotConverter()
            });
            part.SetBinding(DecimalPart.MaximumProperty, new Binding("Maximum")
            {
                Source = this
            });
            part.SetBinding(DecimalPart.MinimumProperty, new Binding("Minimum")
            {
                Source = this
            });
            part.SetBinding(DecimalPart.StepProperty, new Binding("Step")
            {
                Source = this, Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
            });
            part.SetBinding(DecimalPart.ValueProperty, new Binding("Value")
            {
                Source = this, Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
            });
            //SyncBinding.CreateBinding(this, DecimalPartGroup.ValueProperty, part, DecimalPart.ValueProperty);
            SyncBinding.CreateBinding(this, DecimalPartGroup.InitialValueProperty, part, DecimalPart.InitialValueProperty);
            SyncBinding.CreateBinding(
                this,
                DecimalPartGroup.PartValueCommitTriggersProperty,
                part,
                DecimalPart.PartValueCommitTriggersProperty,
                UpdateSourceTrigger.Default);
            part.IsFocusMovedOnTerminalMatches = true;
            part.IsTabStop = true;
            defaultItems.Add(part);
        }