예제 #1
0
 protected override void OnToggleStateChanged(StateChangedEventArgs e)
 {
     if (this.ElementTree != null && this.ElementTree.Control.Parent != null && this.ElementTree.Control is RadRadioButton)
     {
         for (int index = 0; index < this.ElementTree.Control.Parent.Controls.Count; ++index)
         {
             RadControl control = this.ElementTree.Control.Parent.Controls[index] as RadControl;
             if (control != null && control is RadRadioButton)
             {
                 RadRadioButtonElement child = control.RootElement.Children[0] as RadRadioButtonElement;
                 if (child != null && child != this && this.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On)
                 {
                     child.ToggleState = Telerik.WinControls.Enumerations.ToggleState.Off;
                 }
             }
         }
         base.OnToggleStateChanged(e);
     }
     else
     {
         if (this.Parent != null)
         {
             foreach (RadElement child in this.Parent.Children)
             {
                 if (child is RadRadioButtonElement && child != this && this.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On)
                 {
                     (child as RadRadioButtonElement).ToggleState = Telerik.WinControls.Enumerations.ToggleState.Off;
                 }
             }
         }
         base.OnToggleStateChanged(e);
     }
 }
예제 #2
0
        /// <summary>
        /// Create main button element that is specific for RadRadioButton.
        /// </summary>
        /// <returns>The element that encapsulates the funtionality of RadRadioButton</returns>
        protected override RadButtonElement CreateButtonElement()
        {
            RadRadioButtonElement res = new RadRadioButtonElement();

            res.UseNewLayoutSystem   = true;
            res.RadPropertyChanged  += new RadPropertyChangedEventHandler(ButtonElement_RadPropertyChanged);
            res.PropertyChanged     += new PropertyChangedEventHandler(ButtonElement_PropertyChanged);
            res.ToggleStateChanging += new StateChangingEventHandler(ButtonElement_ToggleStateChanging);
            res.ToggleStateChanged  += new StateChangedEventHandler(ButtonElement_ToggleStateChanged);
            return(res);
        }
예제 #3
0
        protected virtual RadToggleButtonElement CreateToggleElement()
        {
            RadToggleButtonElement toggleButton = null;

            CheckType checkType = this.node.CheckType;

            if (checkType == CheckType.CheckBox)
            {
                toggleButton = new TreeNodeCheckBoxElement();
            }
            else if (checkType == CheckType.RadioButton)
            {
                toggleButton = new RadRadioButtonElement();
            }

            return(toggleButton);
        }
예제 #4
0
        protected override void OnToggleStateChanged(StateChangedEventArgs e)
        {
            if ((this.ElementTree != null) && (this.ElementTree.Control.Parent != null))
            {
                if (this.ElementTree.Control is RadRadioButton)
                {
                    for (int i = 0; i < this.ElementTree.Control.Parent.Controls.Count; i++)
                    {
                        RadControl control = this.ElementTree.Control.Parent.Controls[i] as RadControl;


                        if (control != null && control is RadRadioButton)
                        {
                            RadRadioButtonElement radioElement = control.RootElement.Children[0] as RadRadioButtonElement;

                            if (radioElement != null)
                            {
                                if ((radioElement != this) && (this.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On))
                                {
                                    radioElement.ToggleState = Telerik.WinControls.Enumerations.ToggleState.Off;
                                }
                            }
                        }
                    }
                    base.OnToggleStateChanged(e);
                    return;
                }
            }

            if (this.Parent != null)
            {
                foreach (RadElement element in this.Parent.Children)
                {
                    if (element as RadRadioButtonElement != null)
                    {
                        if ((element != this) && (this.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On))
                        {
                            (element as RadRadioButtonElement).ToggleState = Telerik.WinControls.Enumerations.ToggleState.Off;
                        }
                    }
                }
            }

            base.OnToggleStateChanged(e);
        }