public static void DigitTextChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            string m_decimaldigits = "F";

            d_DigitText = e.NewValue.ToString();

            RunaLabel txt = sender as RunaLabel;

            if (txt != null && txt.Template != null)
            {
                TextBlock tb = txt.Template.FindName("RunaLabel", txt) as TextBlock;

                double ftnamber;
                if (d_DigitText.Contains("."))
                {
                    m_decimaldigits += d_DigitText.Substring(d_DigitText.IndexOf('.')).Length - 1;
                }
                else
                {
                    m_decimaldigits = "";
                }
                if (tb != null)
                {
                    Regex textNumberReg = new Regex(@"^[0-9]+[.]?[0-9]+$");
                    Match m             = textNumberReg.Match(tb.Text);
                    if (m.Success)
                    {
                        ftnamber      = Double.Parse(tb.Text);
                        tb.Text       = ftnamber.ToString(m_decimaldigits);
                        txt.TextValue = tb.Text;
                    }
                }
            }
        }
        public static void ForegroundChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            RunaLabel RunaLb = sender as RunaLabel;

            //TextBlock lbl = RunaLb.Template.FindName("lbRuna", RunaLb) as TextBlock;
            //if (lbl != null) lbl.FontSize = (int)e.NewValue;
            (RunaLb.Template.FindName("lbRuna", RunaLb) as TextBlock).Foreground = (Brush) new BrushConverter().ConvertFromString(e.NewValue.ToString());
        }
        public static void TextChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            RunaLabel RunaLb = sender as RunaLabel;
            TextBlock lbl    = RunaLb.Template.FindName("lbRuna", RunaLb) as TextBlock;

            if (lbl != null)
            {
                lbl.Text = e.NewValue.ToString();
            }
        }
        public static void tagFontSizeChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            RunaLabel RunaLb = sender as RunaLabel;
            TextBlock lbl    = RunaLb.Template.FindName("lbRuna", RunaLb) as TextBlock;

            if (lbl != null)
            {
                lbl.FontSize = (int)e.NewValue;
            }
            RunaLb.tagFontSize = (int)e.NewValue;
        }
        public static void tagFontFamilyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            RunaLabel  RunaLb = sender as RunaLabel;
            TextBlock  lbl    = RunaLb.Template.FindName("lbRuna", RunaLb) as TextBlock;
            FontFamily ff     = (FontFamily) new FontFamilyConverter().ConvertFromString(e.NewValue.ToString());

            if (lbl != null)
            {
                lbl.FontFamily = ff;
            }
            RunaLb.FontFamily = ff;
        }
        public static void ContentPositionChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            RunaLabel RunaLb   = sender as RunaLabel;
            TextBlock lbl      = RunaLb.Template.FindName("lbRuna", RunaLb) as TextBlock;
            var       nameInfo = e.NewValue.ToString().Split('|');

            try
            {
                lbl.HorizontalAlignment = (HorizontalAlignment)Enum.Parse(typeof(HorizontalAlignment), nameInfo[0]);
                lbl.VerticalAlignment   = (VerticalAlignment)Enum.Parse(typeof(VerticalAlignment), nameInfo[1]);
            }
            catch (Exception)
            {
            }
        }
        public static void BackgroundChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            RunaLabel RunaLb = sender as RunaLabel;

            (RunaLb.Template.FindName("lbRuna", RunaLb) as TextBlock).Background = (Brush) new BrushConverter().ConvertFromString(e.NewValue.ToString());
        }