using doubleTextBoxes from Syncfusion i am using the NegativeColor attribute to specify different textcolors for negative values. This works fine if i type in a negative value manually in my textboxes. However i have some textboxes that are filled automatically by DataBinding:
this.txtExample.DataBindings.Add(this.txtExample.GetPropertyName((x) => x.BindableValue), mViewModel, mViewModel.GetPropertyName((x) => x.TestProperty));
I tried binding my Property to "Text" and "DoubleValue" instead of "BindableValue", but the text color is not changing for negative values. Any Ideas why the DoubleTextBoxes are behaving this way?
I have tried the same with the Syncfusion DoubleTextBox and the Negative color applied properly in the reported case.
Here is the sample and code snippet for your reference.
class ViewModel
{
Form1 frm = new Form1();
Data data = new Data();
public ViewModel(Form1 _frm)
{
frm = _frm;
foreach (Control ctrl in frm.Controls)
if (ctrl is DoubleTextBox)
(ctrl as DoubleTextBox).DataBindings.Add("Text", data, "unit");
Application.Run(frm);
}
}
public class Data
{
private double n_unit = -5;
public double unit
{
get { return n_unit; }
set { n_unit = value; }
}
}
Sample Link :http://www.syncfusion.com/uploads/user/directTrac/General/DoubleTextBox-NegativeValues1459287934.zip