바인딩 된 항목 (ViewModel 개체 목록)을 자동으로 정렬하는 유일한 방법은 항목의 속성 중 하나를 기반으로 ItemsControl입니다. ItemsControl은 DataTemplate의 일부입니다. CollectionViewSource가 트릭을 수행 할 것이라고 생각했지만 CollectionViewSource를 ItemsControl에 바인딩하는 방법은 무엇입니까? 때라도 코드 dispays에 아무것도는 :DataTemplate에서 바운드 ItemsControl 정렬 (XAML 만 해당)
<--xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"-->
<DataTemplate DataType="{x:Type vm:Company}">
<DataTemplate.Resources>
<CollectionViewSource x:Key="viewSource" Source="{Binding Employees}">
<CollectionViewSource.SortDescriptions>
<scm:SortDescription PropertyName="ID" />
</CollectionViewSource.SortDescriptions>
</CollectionViewSource>
</DataTemplate.Resources>
<Viewbox>
<ItemsControl ItemsSource="{Binding Source={StaticResource viewSource}}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</Viewbox>
</DataTemplate>
"Employess"의 철자가 잘못되었습니다. 그렇지 않으면 나에게 괜찮아 보인다. – Crispy
아니오 여기에 ViewModel 바인딩 ({x : Type vm : Company})이 ressource 범위 내에서 알려지지 않았거나 평가되지 않은 것 같습니다. 종업원은 회사 btw의 자산입니다. – bitbonk