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); }
protected virtual void OnFormat(NumberFormatEventArgs e) { Format?.Invoke(this, e); }