:WPF는 : 사용자 지정 목록 상자 및 목록 <T> 바인딩 :하여 PropertyChanged는 항상 null의
public class QonfServer: QonfBase, INotifyPropertyChanged
{
private string ip;
private bool activated;
public string Ip {
get { return ip; }
}
public bool Activated
{
get { return activated; }
set
{
if (activated == value)
return;
activated = value;
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs("Activated"));
}
}
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
#endregion
}
:
<ListBox x:Name="uicMDSQonfServer">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal"
Margin="0,5,0,5">
<CheckBox IsChecked="{Binding RelativeSource={TemplatedParent},
Path=Activated}" />
<ContentPresenter Content="{Binding RelativeSource={TemplatedParent},
Path=Content}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
내가 dsiplay 및 필요 T는 일반적인 목록과 상호 운용성 내가 액티브를 켜면
public class QonfBase
{
private int id;
public int ID { get; set; }
}
:
QonfBase은 아주 간단 기본 클래스입니다 프로그래밍 방식으로 ated 속성, 확인란 상태를 변경하지 마십시오. 디버그 : PropertyChanged = null. 아무도 모르는가?
출력 창을 확인합니까? 바인딩 오류가 있습니까? –
바인딩 오류가 없습니다. – Pavel