Exemplo n.º 1
0
        private void radDataFilter1_NodeFormatting(object sender, TreeNodeFormattingEventArgs e)
        {
            DataFilterCriteriaElement nodeElement = e.NodeElement as DataFilterCriteriaElement;

            if (nodeElement == null)
            {
                return;
            }
            nodeElement.FieldElement.ChangeCursorOnMouseOver = false;
            nodeElement.FieldElement.Text = this.column.HeaderText;
        }
Exemplo n.º 2
0
        private void TreeViewElement_NodeFormatting(object sender, Telerik.WinControls.UI.TreeNodeFormattingEventArgs args)
        {
            if (!radCheckBoxFormatting.IsChecked)
            {
                args.NodeElement.ContentElement.ResetValue(LightVisualElement.FontProperty, Telerik.WinControls.ValueResetFlags.Local);
                args.NodeElement.ContentElement.DisableHTMLRendering     = true;
                ((LightVisualElement)args.NodeElement.Children[0]).Image = null;
                return;
            }

            DataRowView rowView = (DataRowView)args.Node.DataBoundItem;

            args.NodeElement.ImageElement.Image = (Image)rowView["Icon"];

            args.NodeElement.ClipDrawing = false;

            RadElement element = args.NodeElement.Children[0];

            LightVisualElement imageElement = null;

            if (element.Name != "StateImage")
            {
                imageElement      = new LightVisualElement();
                imageElement.Name = "StateImage";
                imageElement.StretchHorizontally = false;
                imageElement.ImageLayout         = ImageLayout.Center;
                imageElement.MinSize             = new System.Drawing.Size(20, 20);
                imageElement.DrawBorder          = true;
                imageElement.DrawFill            = true;
                imageElement.GradientStyle       = GradientStyles.Linear;
                imageElement.GradientAngle       = 0;
                imageElement.NumberOfColors      = 2;
                imageElement.BorderBoxStyle      = BorderBoxStyle.FourBorders;

                imageElement.BorderRightWidth = 1;
                imageElement.FitToSizeMode    = RadFitToSizeMode.FitToParentBounds;
                args.NodeElement.Children.Insert(0, imageElement);

                imageElement.BackColor              = Color.FromArgb(255, 255, 255);
                imageElement.BackColor2             = Color.FromArgb(226, 226, 226);
                imageElement.BorderRightColor       = Color.FromArgb(180, 184, 191);
                imageElement.BorderRightShadowColor = Color.FromArgb(241, 241, 241);
                imageElement.BorderLeftWidth        = 0;
                imageElement.BorderTopWidth         = 0;
                imageElement.BorderBottomWidth      = 0;
            }
            else
            {
                imageElement = (LightVisualElement)args.NodeElement.Children[0];
            }


            if (rowView["Title"] != DBNull.Value)
            {
                args.NodeElement.ContentElement.Text = (string)rowView["Name"] + " - " + (string)rowView["Title"];
                if ((bool)rowView["IsNew"])
                {
                    if (boldFont == null)
                    {
                        boldFont = new Font(this.Font, FontStyle.Bold);
                    }
                    args.NodeElement.ContentElement.Font = boldFont;
                }
                else
                {
                    args.NodeElement.ContentElement.ResetValue(LightVisualElement.FontProperty, Telerik.WinControls.ValueResetFlags.Local);
                }

                if (rowView["IsImportant"] != DBNull.Value)
                {
                    if ((bool)rowView["IsImportant"])
                    {
                        ((LightVisualElement)args.NodeElement.Children[0]).Image = Resources.TV_Exclamation;
                    }
                    else
                    {
                        ((LightVisualElement)args.NodeElement.Children[0]).Image = null;
                    }
                }

                if (rowView["HasFlag"] != DBNull.Value)
                {
                    if ((bool)rowView["HasFlag"])
                    {
                        ((LightVisualElement)args.NodeElement.Children[0]).Image = Resources.TV_RedFlag;
                    }
                    else
                    {
                        ((LightVisualElement)args.NodeElement.Children[0]).Image = null;
                    }
                }
            }
            else if (rowView["NewItemCount"] != DBNull.Value)
            {
                int newItemCount = (int)rowView["NewItemCount"];
                args.NodeElement.ContentElement.DisableHTMLRendering = false;
                args.NodeElement.ContentElement.Text = "<html> " + args.Node.Text + "<color=blue>(" + newItemCount + ")";
            }
        }