모델에서 바인딩 된 항목을 목록 상자에 어떻게 정렬합니까?WPF order listbox items
나는이 모델 정의 : 나는 모든 알림 항목에 할당 된 ID로 그것을 주문해야
public ObservableCollection<NotificationItem> Classes:
합니다. 현재
나는이 정의 : I 모델의 참조가
<ListBox ItemsSource="{Binding Classes, Source={StaticResource model}}"
ScrollViewer.VerticalScrollBarVisibility="Visible"
DataContext="{Binding}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Label Content="{Binding Name}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
:
<Model:ClassModel x:Key="model" />
업데이트 : 모델의 초기화가
try
{
this.notifierModel = this.Resources["model"] as ClassModel;
this.classController.Initialize(this.notifierModel);
}
catch
{
// todo: handle exception
}
에 의해 이루어집니다
thnx 마침내 나는 어떻게이 일을 다우 이해 ... thnx – cpoDesign