0
동일한 인덱스를 가진 3 개의 다른 소스에 바인딩해야하는 dataTemplate이있는 ListView가 있습니다. 소스 (chart
)는 xaml에만 있기 때문에 XAML에서 완전히이 작업을 수행해야한다고 생각합니다. 나는 MVVM 패턴을 사용하고 있습니다.해야 "작품은, 인덱스 i
공통 핵심"나는 그것이 어떻게 기록한 한
".여러 소스를 ListView에 바인딩
<ListView ItemsSource="{Binding ???}">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel>
<!-- Small rectangle filled with the same color as the corresponding line -->
<Rectangle
Height="10"
Width="10"
Fill="{Binding ElementName=chart, Path=Series[i].LineStroke}" />
<!-- The title of the corresponding line -->
<TextBlock
x:Name="Title"
Text="{Binding ElementName=chart, Path=Series[i].DataSeries.Title}" />
<!-- The actual value of the corresponding line on the current position-->
<TextBlock
x:Name="Value"
Text="{Binding ElementName=chart, Path=Behaviour.Behaviours[0].CurrentPoints[i].Y}" />
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
MVVM을 사용하고 있습니다.이 경우 ** ViewModel **을 생성하면 안됩니까? Series와 Behavior를 모두 포함하는 클래스. 그런 다음이 ViewModel을 ListView의 바인딩 소스로 사용하십시오. – Damb
나는 차트 컨트롤에 대한 데이터 만 제공하는 ViewModel을 가지고 있지만 차트는 색상을 만들고 차트 만 현재 선택된 Y- 포인트를 알고 있습니다. 차트는 뷰에서만 알 수 있습니다. – chriszero