所选项目对象被击中两次。如何解决它。我在堆栈布局中使用两个listview都引用同一个对象。
<ListView x:Name="listview"ItemsSource="{Binding NewDeviceSessionList}"SelectedItem="{Binding DeviceSession, Mode=TwoWay}">
private DeviceSession _deviceSession;
public DeviceSession DeviceSession {
get => _deviceSession;
set=> SetProperty(ref _deviceSession, value);
CallSome();
}
private void CallSome()
{
if(DeviceSession==null) return;
}
答案 0 :(得分:0)
使用以下代码修复
public DeviceSession DeviceSession
{
get => _deviceSession;
set
{
if (_deviceSession != value)
{
SetProperty(ref _deviceSession, value);
CallSome();
}
}
}