0
ItemsSource가 DataRow의 ObservableCollection으로 설정된 Listbox가 있습니다. 이 예제에서 각 DataRow에 5 개의 열이 있다고 가정 해 봅시다.WPF에서 현재 데이터 항목의 기본 인덱서에 바인딩하는 구문은 무엇입니까?
ListBox의 DataTemplate에는 5 개의 텍스트 블록 (각 열에 대해 1 개)이 있습니다. 내 질문에 어떻게 컬럼 값을 얻기 위해 행의 인덱서에 바인딩 할 수 있습니까? 여기
내 시도하지만 아무것도 내가 구문 잘못이 있어야합니다 표시하지 :<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Path=.[0]}" />
<TextBlock Text="{Binding Path=.[1]}" />
<TextBlock Text="{Binding Path=.[2]}" />
<TextBlock Text="{Binding Path=.[3]}" />
<TextBlock Text="{Binding Path=.[4]}" />
</StackPanel>
</DataTemplate>
이미이 같은 짓을했기 때문에 내가 인덱서가 바인딩에 사용할 수있는 것을 알고를 :
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Path=Collection[0].Name}" />
<TextBlock Text="{Binding Path=Collection[1].Name}" />
<TextBlock Text="{Binding Path=Collection[2].Name}" />
<TextBlock Text="{Binding Path=Collection[3].Name}" />
<TextBlock Text="{Binding Path=Collection[4].Name}" />
</StackPanel>
</DataTemplate>
내 구문을 수정하는 데 도움을 주시면 감사하겠습니다.