我使用devexpress TreeListView时遇到问题 AllowRecursiveNodeChecking = True事件TreeListView1_OnNodeCheckStateChanged运行多次,我不知道如何在CheckBox更改时运行一次:
我的xaml:
SUM
在我的观点中:
<dxg:TreeListControl.View>
<dxg:TreeListView CustomColumnDisplayText="CustomColumns" ImageFieldName="LineIcon" ShowCheckboxes="True" AllowRecursiveNodeChecking="True" NodeCheckStateChanged="TreeListView1_OnNodeCheckStateChanged" Name="TreeListView1" KeyFieldName="ID" ParentFieldName="ParentID" FontSize="13" NodeImageSize="16,16" ShowNodeImages="True" FontFamily="Segoe UI" FontWeight="Normal" />
</dxg:TreeListControl.View>
我知道我可以通过订阅/取消订阅事件来处理这个问题,但我不知道该怎么做而且devexpress TreeListView不存在AfterEvent
感谢您的帮助
答案 0 :(得分:0)
我采取了哪些措施来避免这个问题:
public bool ItemChecked = false;
private void TreeListView1_OnNodeCheckStateChanged(object sender, TreeListNodeEventArgs e)
{
ItemChecked = true;
// To be sure that our code will run only if checkbox have changed
}
private void TreeListView1_OnNodeChanged(object sender, TreeListNodeChangedEventArgs e)
{
if (ItemChecked)
{
// My Code
}
ItemChecked = false;
}