1
我試圖儘可能使用數據綁定來創建我的gui。因爲我有收集頻道,也有步驟列表。我知道想要的是結合這些藏品XAML元素,並讓他們顯示在下面的順序:wpf中observablecollection的數據綁定,並以特殊順序填充gui
Channel1 step1 step2 step3 step4
Channel2 step1 step2 step3 step4
我嵌套ItemsControls這樣試了一下:
<ItemsControl ItemsSource="{Binding Path=channels}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<ItemsControl ItemsSource="{Binding Path=steps}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<GUI:stepAnalog></GUI:stepAnalog>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
但我所實現的是什麼像訂購元素,如:
channel1 step1 step2 step3 channel2 step1 step2 step3
或
channel1
step1
step2
step3
channel2
step1
step2
step3
在使用數據綁定的wpf中有沒有解決方案,還是我必須通過遍歷元素並將它們放置在程序中來編程?