Пример #1
0
        protected virtual string GetFormatText(decimal value)
        {
            string format;
            string formatedText;

            if (string.IsNullOrEmpty(FormatString))
            {
                format = "{0}";
            }
            else
            {
                format = "{0:" + FormatString + "}";
            }
            try
            {
                formatedText = string.Format(format, value);
            }
            catch
            {
                formatedText = base.Text;
            }

            var e = new NumberFormatEventArgs(this.Value, this.FormatString, formatedText);

            OnFormat(e);
            return(e.FormatedText);
        }
Пример #2
0
 protected virtual void OnFormat(NumberFormatEventArgs e)
 {
     Format?.Invoke(this, e);
 }