Beispiel #1
0
 protected override void InitializeRootElement(RootRadElement rootElement)
 {
     base.InitializeRootElement(rootElement);
     rootElement.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize;
     //we want to display focus cues (if OS allows for such) for buttons
     this.ElementTree.ComponentTreeHandler.Behavior.AllowShowFocusCues = true;
 }
 protected override void OnBubbleEvent(RadElement sender, RoutedEventArgs args)
 {
     if (args.RoutedEvent == RadElement.MouseDownEvent && sender == this.textBoxItem)
     {
         if (RadModalFilter.Instance.ActiveDropDown != null && !RadModalFilter.Instance.Suspended)
         {
             RadModalFilter.Instance.Suspended = true;
             Point client = this.textBoxItem.HostedControl.PointToClient(Control.MousePosition);
             if (this.textBoxItem.HostedControl.ClientRectangle.Contains(client))
             {
                 Telerik.WinControls.NativeMethods.SendMessage(new HandleRef((object)null, this.textBoxItem.HostedControl.Handle), 513, 1, Telerik.WinControls.NativeMethods.Util.MAKELPARAM(client.X, client.Y));
             }
         }
     }
     else if (args.RoutedEvent == RadTextBoxItem.MultilineEvent && sender == this.textBoxItem)
     {
         args.Canceled          = true;
         this.StretchVertically = this.textBoxItem.Multiline;
         RootRadElement parent = this.Parent as RootRadElement;
         if (parent != null)
         {
             parent.StretchVertically = this.textBoxItem.Multiline;
         }
     }
     base.OnBubbleEvent(sender, args);
 }
Beispiel #3
0
        protected override void CreateChildItems(RadElement parent)
        {
            this.listBoxElement = new RadListBoxElement();
            this.listBoxElement.ForceViewportWidth    = true;
            this.listBoxElement.SelectedIndexChanged += new EventHandler(listBoxElement_SelectedIndexChanged);
            this.listBoxElement.SelectedItemChanged  += new RadListBoxSelectionChangeEventHandler(listBoxElement_SelectedItemChanged);
            this.listBoxElement.SortItemsChanged     += new EventHandler(listBoxElement_SortItemsChanged);
            this.listBoxElement.SelectedValueChanged += new EventHandler(listBoxElement_SelectedValueChanged);
            this.listBoxElement.ItemDataBound        += new ItemDataBoundEventHandler(listBoxElement_ItemDataBound);
            this.listBoxElement.ItemDataBinding      += new ItemDataBindingEventHandler(listBoxElement_ItemDataBinding);

            RootRadElement root = this.RootElement;

            this.listBoxElement.BindProperty(RadElement.MinSizeProperty, root, RadElement.MinSizeProperty, PropertyBindingOptions.OneWay);
            this.listBoxElement.BindProperty(RadElement.MaxSizeProperty, root, RadElement.MaxSizeProperty, PropertyBindingOptions.OneWay);
            this.listBoxElement.BindProperty(RadElement.AutoSizeProperty, root, RadElement.AutoSizeProperty, PropertyBindingOptions.OneWay);
            this.listBoxElement.BindProperty(RadElement.AutoSizeModeProperty, root, RadElement.AutoSizeModeProperty, PropertyBindingOptions.OneWay);

            this.RootElement.Children.Add(listBoxElement);
        }
        public static List <IComponent> DiscoverCommandsContexts(IComponent source)
        {
            if (source == null)
            {
                return(null);
            }
            List <IComponent> returnList = new List <IComponent>(1);
            List <IComponent> tempList   = null;

            if (typeof(RadControl).IsAssignableFrom(source.GetType()) ||
                typeof(RadItem).IsAssignableFrom(source.GetType()))
            {
                TransferListUniquePart <IComponent>(source, returnList);
            }
            //testing instance implementation of Telerik speciffic interfaces
            if (source is RadControl)
            {
                RootRadElement rootElement = (source as RadControl).RootElement;
                if (rootElement != null &&
                    (rootElement.Children.Count > 0))
                {
                    foreach (RadElement element in rootElement.Children) //RadElement
                    {
                        IComponent componentElement = element as IComponent;
                        if (componentElement != null && element is IItemsOwner)
                        {
                            tempList = DiscoverCommandsContexts(componentElement);
                            if (returnList != null)
                            {
                                TransferListUniquePart <IComponent>(tempList, returnList);
                            }
                        }
                    }
                }
            }
            if (returnList.Count > 0)
            {
                return(returnList);
            }
            return(null);
        }
        public static List <IComponent> DiscoverCommandsSources(IComponent source)
        {
            if (source == null)
            {
                return(null);
            }
            List <IComponent> returnList = new List <IComponent>(1);
            List <IComponent> tempList   = null;

            if (DiscoverCommands(source) != null)
            {
                TransferListUniquePart <IComponent>(source, returnList);
            }
            //testing instance implementation of Telerik speciffic interfaces
            if (source is RadControl)
            {
                RootRadElement rootElement = (source as RadControl).RootElement;
                if (rootElement != null &&
                    (rootElement.Children.Count > 0))
                {
                    for (int i = 0; i < rootElement.Children.Count; i++)
                    {
                        IComponent element = rootElement.Children[i] as IComponent;
                        if (element != null && element is IItemsOwner)
                        {
                            tempList = DiscoverCommandsSources(element);
                            if (returnList != null)
                            {
                                TransferListUniquePart <IComponent>(tempList, returnList);
                            }
                        }
                    }
                }
            }
            if (returnList.Count > 0)
            {
                return(returnList);
            }
            return(null);
        }
        public static List <IComponent> DiscoverCommandsSources(IComponent source)
        {
            if (source == null)
            {
                return((List <IComponent>)null);
            }
            List <IComponent> destinationList = new List <IComponent>(1);

            if (CommandBaseConverter.DiscoverCommands(source) != null)
            {
                CommandBaseConverter.TransferListUniquePart <IComponent>(source, destinationList);
            }
            if (source is RadControl)
            {
                RootRadElement rootElement = (source as RadControl).RootElement;
                if (rootElement != null && rootElement.Children.Count > 0)
                {
                    for (int index = 0; index < rootElement.Children.Count; ++index)
                    {
                        IComponent child = rootElement.Children[index] as IComponent;
                        if (child != null && child is IItemsOwner)
                        {
                            List <IComponent> sourceList = CommandBaseConverter.DiscoverCommandsSources(child);
                            if (destinationList != null)
                            {
                                CommandBaseConverter.TransferListUniquePart <IComponent>(sourceList, destinationList);
                            }
                        }
                    }
                }
            }
            if (destinationList.Count > 0)
            {
                return(destinationList);
            }
            return((List <IComponent>)null);
        }
        public static List <IComponent> DiscoverCommandsContexts(IComponent source)
        {
            if (source == null)
            {
                return((List <IComponent>)null);
            }
            List <IComponent> destinationList = new List <IComponent>(1);

            if (typeof(RadControl).IsAssignableFrom(source.GetType()) || typeof(RadItem).IsAssignableFrom(source.GetType()))
            {
                CommandBaseConverter.TransferListUniquePart <IComponent>(source, destinationList);
            }
            if (source is RadControl)
            {
                RootRadElement rootElement = (source as RadControl).RootElement;
                if (rootElement != null && rootElement.Children.Count > 0)
                {
                    foreach (RadElement child in rootElement.Children)
                    {
                        IComponent source1 = child as IComponent;
                        if (source1 != null && child is IItemsOwner)
                        {
                            List <IComponent> sourceList = CommandBaseConverter.DiscoverCommandsContexts(source1);
                            if (destinationList != null)
                            {
                                CommandBaseConverter.TransferListUniquePart <IComponent>(sourceList, destinationList);
                            }
                        }
                    }
                }
            }
            if (destinationList.Count > 0)
            {
                return(destinationList);
            }
            return((List <IComponent>)null);
        }
Beispiel #8
0
        public static Color GetBackColor(LightVisualElement element)
        {
            RadElement         radElement         = (RadElement)element;
            Color              color              = Color.Empty;
            LightVisualElement lightVisualElement = (LightVisualElement)null;

            if (element.BackColor.A < (byte)200 || !element.DrawFill)
            {
                while (radElement.Parent != null)
                {
                    radElement         = radElement.Parent;
                    lightVisualElement = radElement as LightVisualElement;
                    if (lightVisualElement != null && (lightVisualElement.BackColor.A > (byte)200 && lightVisualElement.DrawFill))
                    {
                        break;
                    }
                }
            }
            else
            {
                lightVisualElement = radElement as LightVisualElement;
            }
            if (lightVisualElement != null)
            {
                color = GridExportUtils.ColorMixer(lightVisualElement.GradientStyle, lightVisualElement.NumberOfColors, lightVisualElement.GradientPercentage, lightVisualElement.GradientPercentage2, lightVisualElement.BackColor, lightVisualElement.BackColor2, lightVisualElement.BackColor3, lightVisualElement.BackColor4);
            }
            else
            {
                RootRadElement rootRadElement = radElement as RootRadElement;
                if (rootRadElement != null)
                {
                    color = rootRadElement.BackColor;
                }
            }
            return(color);
        }
Beispiel #9
0
 /// <summary>
 /// initialize root element
 /// </summary>
 /// <param name="rootElement"></param>
 protected override void InitializeRootElement(RootRadElement rootElement)
 {
     base.InitializeRootElement(rootElement);
     rootElement.StretchVertically = false;
 }
Beispiel #10
0
        protected override void InitializeRootElement(RootRadElement rootElement)
        {
            base.InitializeRootElement(rootElement);

            rootElement.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize;
        }
Beispiel #11
0
 protected override void InitializeRootElement(RootRadElement rootElement)
 {
     base.InitializeRootElement(rootElement);
 }
Beispiel #12
0
 protected override void InitializeRootElement(RootRadElement rootElement)
 {
     this.RootElement.StretchVertically = true;
     base.InitializeRootElement(rootElement);
 }
Beispiel #13
0
 protected override void InitializeRootElement(RootRadElement rootElement)
 {
     base.InitializeRootElement(rootElement);
     rootElement.AutoSizeMode      = RadAutoSizeMode.WrapAroundChildren;
     rootElement.StretchVertically = false;
 }
Beispiel #14
0
 protected override void InitializeRootElement(RootRadElement rootElement)
 {
     base.InitializeRootElement(rootElement);
     this.ElementTree.ComponentTreeHandler.Behavior.AllowShowFocusCues = true;
 }