Exemplo n.º 1
0
        /// <summary>
        /// 设置当前节点的选中样式
        /// </summary>
        private void UpdateSelectStyle(TreeViewItemEx ex, ColorToneEffect ct, SolidColorBrush backColor, SolidColorBrush fillColor)
        {
            var grid = ex.Template.FindName("gr", ex) as Grid;
            var rec  = ex.Template.FindName("moveBackGround", ex) as Rectangle;
            var img  = ex.Template.FindName("img", ex) as Image;
            var img1 = ex.Template.FindName("img1", ex) as Image;
            var img2 = ex.Template.FindName("img2", ex) as Image;

            if (grid != null)
            {
                grid.Background = backColor;
            }
            if (rec != null)
            {
                rec.Fill = fillColor;
            }
            if (img != null)
            {
                img.Effect = ct;
            }
            if (img1 != null)
            {
                img1.Effect = ct;
            }
            if (img2 != null)
            {
                img2.Effect = ct;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 设置当前节点的所有父节点样式
        /// </summary>
        /// <param name="ex"></param>
        /// <param name="ct"></param>
        private void UpdateSelectBaseStyle(TreeViewItemEx ex, ColorToneEffect ct)
        {
            var img  = ex.Template.FindName("img", ex) as Image;
            var img1 = ex.Template.FindName("img1", ex) as Image;
            var img2 = ex.Template.FindName("img2", ex) as Image;

            if (img != null)
            {
                img.Effect = ct;
            }
            if (img1 != null)
            {
                img1.Effect = ct;
            }
            if (img2 != null)
            {
                img2.Effect = ct;
            }
        }