Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/visual-studio-2010/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wpf IntegerUpDown触发父控件SelectionChanged事件_Wpf_Wpftoolkit_Integerupdown - Fatal编程技术网

Wpf IntegerUpDown触发父控件SelectionChanged事件

Wpf IntegerUpDown触发父控件SelectionChanged事件,wpf,wpftoolkit,integerupdown,Wpf,Wpftoolkit,Integerupdown,我在每个ListBoxItem中都有一个带有IntegerUpDown的ListBox控件。一切正常,但当IntegerUpDown达到我设置的最小值或最大值时,如果单击禁用的箭头,它将触发listbox的selectionchanged事件。 您是否已尝试挂接selectionchanged事件,检查您的禁用状态,如果禁用,请将SelectionChangedEventArgs.Handled设置为true 下面是另一个如何检查selectionchanged事件是否来自IntegerUp

我在每个ListBoxItem中都有一个带有IntegerUpDown的ListBox控件。一切正常,但当IntegerUpDown达到我设置的最小值或最大值时,如果单击禁用的箭头,它将触发listbox的selectionchanged事件。


您是否已尝试挂接selectionchanged事件,检查您的禁用状态,如果禁用,请将
SelectionChangedEventArgs.Handled
设置为
true


下面是另一个

如何检查selectionchanged事件是否来自IntegerUpDown控件?Source和OriginalSource都指向listbox。除非我知道事件源于IntegerUpDown,否则我无法处理它。除非你发布代码,否则我无法提供任何进一步的详细信息@spongeI通过为IntegerUpDown添加MouseLeftButtonDown事件修复了这个问题,我在该事件中设置Handled=true。不过感觉有点“黑客味”。
private void lbItem_SelectionChanged(Object sender, SelectionChangedEventArgs e)
{    
     if (//e.source != integerupdowncontrol)
         //update other view, etc.  
}
private void OnSelectionChanged(Object sender, SelectionChangedEventArgs args){
      if(/*My min or max has been reached*/){
            args.Handled = true;
            return;
      }
}