private void OnChecked(object sender, RoutedEventArgs e)
{
try
{
LAB_TEST t = new LAB_TEST();
CheckBox chk = (CheckBox)e.OriginalSource;
if (e.OriginalSource is CheckBox)
{
int OID = Convert.ToInt32(((CheckBox)chk).Tag);
t = eb.TestGetByOID(OID);
bool has = advisedTests.Any(test => test.OID == OID);
if (!has)
{
if (txtGrossAmount.Text != string.Empty)
{
decimal amount = Convert.ToDecimal(txtGrossAmount.Text);
amount += Convert.ToDecimal(t.PRICE);
txtGrossAmount.Text = amount.ToString();
}
else
{
txtGrossAmount.Text = t.PRICE.ToString();
}
advisedTests.Add(t);
}
}
}
catch (Exception ex)
{
}
}
我面临这个问题,我在 Datagrid 中绑定了复选框,并且我正在进行一些简单的数学计算,当我们单击该复选框时,它应该在文本框中添加总和,并且它正在执行此操作,但问题是鼠标向上滚动现在,自动向下选中和取消选中复选框,文本框中所选项目的总价格更多,而所选复选框更少或有时更多,因此鼠标向上或向下滚动会产生此问题。任何想法????
谢谢
你需要设置VirtualizingStackPanel.IsVirtualizing="False"
在你的网格中!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)