示例#1
0
        protected override void CreateChildElements()
        {
            this.fillPrimitive              = new FillPrimitive();
            this.fillPrimitive.Class        = "ButtonFill";
            this.fillPrimitive.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize;

            this.borderPrimitive              = new BorderPrimitive();
            this.borderPrimitive.Class        = "ButtonBorder";
            this.borderPrimitive.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize;

            this.textPrimitive = new TextPrimitive();
            this.textPrimitive.SetValue(ImageAndTextLayoutPanel.IsTextPrimitiveProperty, true);
            this.textPrimitive.BindProperty(TextPrimitive.TextProperty, this, RadButtonItem.TextProperty, PropertyBindingOptions.OneWay);

            this.imagePrimitive = new ImagePrimitive();
            this.imagePrimitive.SetValue(ImageAndTextLayoutPanel.IsImagePrimitiveProperty, true);
            this.imagePrimitive.BindProperty(ImagePrimitive.ImageIndexProperty, this, RadButtonItem.ImageIndexProperty, PropertyBindingOptions.TwoWay);
            this.imagePrimitive.BindProperty(ImagePrimitive.ImageProperty, this, RadButtonItem.ImageProperty, PropertyBindingOptions.TwoWay);
            this.imagePrimitive.BindProperty(ImagePrimitive.ImageKeyProperty, this, RadButtonItem.ImageKeyProperty, PropertyBindingOptions.TwoWay);
            this.imagePrimitive.BindProperty(ImagePrimitive.UseSmallImageListProperty, this, RadButtonElement.UseSmallImageListProperty, PropertyBindingOptions.TwoWay);

            this.layoutPanel = new ImageAndTextLayoutPanel();
            this.layoutPanel.BindProperty(ImageAndTextLayoutPanel.AutoSizeModeProperty, this, RadButtonItem.AutoSizeModeProperty, PropertyBindingOptions.OneWay);
            this.layoutPanel.BindProperty(RadElement.StretchHorizontallyProperty, this, RadElement.StretchHorizontallyProperty, PropertyBindingOptions.OneWay);
            this.layoutPanel.BindProperty(RadElement.StretchVerticallyProperty, this, RadElement.StretchVerticallyProperty, PropertyBindingOptions.OneWay);
            this.layoutPanel.BindProperty(ImageAndTextLayoutPanel.DisplayStyleProperty, this, RadButtonItem.DisplayStyleProperty, PropertyBindingOptions.OneWay);

            this.layoutPanel.BindProperty(ImageAndTextLayoutPanel.ImageAlignmentProperty, this, RadButtonItem.ImageAlignmentProperty, PropertyBindingOptions.OneWay);
            this.layoutPanel.BindProperty(ImageAndTextLayoutPanel.TextAlignmentProperty, this, RadButtonItem.TextAlignmentProperty, PropertyBindingOptions.OneWay);
            this.layoutPanel.BindProperty(ImageAndTextLayoutPanel.TextImageRelationProperty, this, RadButtonItem.TextImageRelationProperty, PropertyBindingOptions.OneWay);

            this.layoutPanel.Children.Add(this.imagePrimitive);
            this.layoutPanel.Children.Add(this.textPrimitive);
            //p.p. 6.4.2009 fix bug with text layout
            this.textPrimitive.BindProperty(RadElement.AlignmentProperty, this, RadButtonItem.TextAlignmentProperty, PropertyBindingOptions.OneWay);
            this.imagePrimitive.BindProperty(RadElement.AlignmentProperty, this, RadButtonItem.ImageAlignmentProperty, PropertyBindingOptions.OneWay);
            //end add
            this.borderPrimitive.ZIndex = 2;
            this.borderPrimitive.BindProperty(RadElement.IsItemFocusedProperty, this, RadElement.IsFocusedProperty, PropertyBindingOptions.OneWay);

            FocusPrimitive focusPrimitive = new FocusPrimitive(this.borderPrimitive);

            focusPrimitive.ZIndex     = 4;
            focusPrimitive.Visibility = ElementVisibility.Hidden;
            focusPrimitive.Class      = "ButtonFocus";
            this.layoutPanel.ZIndex   = 3;

            focusPrimitive.BindProperty(RadElement.IsItemFocusedProperty, this, RadElement.IsFocusedProperty, PropertyBindingOptions.OneWay);

            this.Children.Add(this.fillPrimitive);
            this.Children.Add(this.layoutPanel);
            this.Children.Add(this.borderPrimitive);
            this.Children.Add(focusPrimitive);
        }
示例#2
0
        protected override void CreateChildElements()
        {
            this.fillPrimitive          = new FillPrimitive();
            this.fillPrimitive.Class    = "ButtonFill";
            this.borderPrimitive        = new BorderPrimitive();
            this.borderPrimitive.Class  = "ButtonBorder";
            this.borderPrimitive.ZIndex = 2;
            int num1 = (int)this.borderPrimitive.BindProperty(RadElement.IsItemFocusedProperty, (RadObject)this, RadElement.IsFocusedProperty, PropertyBindingOptions.OneWay);

            this.textPrimitive = new TextPrimitive();
            int num2 = (int)this.textPrimitive.SetValue(ImageAndTextLayoutPanel.IsTextPrimitiveProperty, (object)true);
            int num3 = (int)this.textPrimitive.BindProperty(TextPrimitive.TextProperty, (RadObject)this, RadItem.TextProperty, PropertyBindingOptions.OneWay);
            int num4 = (int)this.textPrimitive.BindProperty(TextPrimitive.TextAlignmentProperty, (RadObject)this, RadButtonItem.TextAlignmentProperty, PropertyBindingOptions.OneWay);

            this.imagePrimitive = new ImagePrimitive();
            int num5  = (int)this.imagePrimitive.SetValue(ImageAndTextLayoutPanel.IsImagePrimitiveProperty, (object)true);
            int num6  = (int)this.imagePrimitive.BindProperty(ImagePrimitive.ImageIndexProperty, (RadObject)this, RadButtonItem.ImageIndexProperty, PropertyBindingOptions.TwoWay);
            int num7  = (int)this.imagePrimitive.BindProperty(ImagePrimitive.ImageProperty, (RadObject)this, RadButtonItem.ImageProperty, PropertyBindingOptions.TwoWay);
            int num8  = (int)this.imagePrimitive.BindProperty(ImagePrimitive.ImageKeyProperty, (RadObject)this, RadButtonItem.ImageKeyProperty, PropertyBindingOptions.TwoWay);
            int num9  = (int)this.imagePrimitive.BindProperty(ImagePrimitive.UseSmallImageListProperty, (RadObject)this, RadButtonElement.UseSmallImageListProperty, PropertyBindingOptions.TwoWay);
            int num10 = (int)this.imagePrimitive.BindProperty(RadElement.AlignmentProperty, (RadObject)this, RadButtonItem.ImageAlignmentProperty, PropertyBindingOptions.OneWay);

            this.layoutPanel        = new ImageAndTextLayoutPanel();
            this.layoutPanel.ZIndex = 3;
            int num11 = (int)this.layoutPanel.BindProperty(RadElement.StretchHorizontallyProperty, (RadObject)this, RadElement.StretchHorizontallyProperty, PropertyBindingOptions.OneWay);
            int num12 = (int)this.layoutPanel.BindProperty(RadElement.StretchVerticallyProperty, (RadObject)this, RadElement.StretchVerticallyProperty, PropertyBindingOptions.OneWay);
            int num13 = (int)this.layoutPanel.BindProperty(ImageAndTextLayoutPanel.DisplayStyleProperty, (RadObject)this, RadButtonItem.DisplayStyleProperty, PropertyBindingOptions.OneWay);
            int num14 = (int)this.layoutPanel.BindProperty(ImageAndTextLayoutPanel.ImageAlignmentProperty, (RadObject)this, RadButtonItem.ImageAlignmentProperty, PropertyBindingOptions.OneWay);
            int num15 = (int)this.layoutPanel.BindProperty(ImageAndTextLayoutPanel.TextAlignmentProperty, (RadObject)this, RadButtonItem.TextAlignmentProperty, PropertyBindingOptions.OneWay);
            int num16 = (int)this.layoutPanel.BindProperty(ImageAndTextLayoutPanel.TextImageRelationProperty, (RadObject)this, RadButtonItem.TextImageRelationProperty, PropertyBindingOptions.OneWay);

            this.layoutPanel.Children.Add((RadElement)this.imagePrimitive);
            this.layoutPanel.Children.Add((RadElement)this.textPrimitive);
            this.focusPrimitive            = new FocusPrimitive(this.borderPrimitive);
            this.focusPrimitive.Class      = "ButtonFocus";
            this.focusPrimitive.ZIndex     = 4;
            this.focusPrimitive.Visibility = ElementVisibility.Hidden;
            int num17 = (int)this.focusPrimitive.BindProperty(RadElement.IsItemFocusedProperty, (RadObject)this, RadElement.IsFocusedProperty, PropertyBindingOptions.OneWay);

            this.Children.Add((RadElement)this.fillPrimitive);
            this.Children.Add((RadElement)this.layoutPanel);
            this.Children.Add((RadElement)this.borderPrimitive);
            this.Children.Add((RadElement)this.focusPrimitive);
        }