我会做这种方式:
public bool PositionModifiedByUser
{ /* implement IPropertyChanged if need to bind to this property */ }
// use this property from code
public double Position
{
get { return m_position ; }
set { SetPropertyValue ("PositionUI", ref m_position, value) ;
PositionModifiedByUser = false ; }
}
// bind to this property from the UI
public double PositionUI
{
get { return m_position ; }
set { if (SetPropertyValue ("PositionUI", ref m_position, value))
PositionModifiedByUser = true ; }
}
SetPropertyValue是检查平等和激发属性更改通知,如果该值实际上改变帮手。
怎么样的鼠标按下和KEYDOWN事件?当用户通过鼠标或键盘做某事时,两个事件都会发生。 – 2013-03-18 12:56:26
您可以检查滑块是否有焦点。如果确实如此,则该值将从UI中更改。但是,这将取决于将代码从后面更改为滑块。 – AbZy 2013-03-18 12:58:55