我已經嘗試了所有我能想到的東西,并且尋找了很多解決方案
這就是我正在嘗試計算的組標題的當前 XMAL 部分
<ListBox.GroupStyle>
<GroupStyle >
<GroupStyle.HeaderTemplate>
<DataTemplate>
<Grid>
<TextBlock x:Name="GrpDate" FontWeight="Bold" FontSize="14" Text="{Binding Name}" TextAlignment="Right" Grid.Row="0"/>
<TextBlock x:Name="GrpNote" FontWeight="Bold" FontSize="14" Text="{Binding Note }" TextAlignment="Right" Grid.Row="1"/>
<TextBlock x:Name="GrpNote1" FontWeight="Bold" FontSize="14" Text="{Binding orderid }" TextAlignment="Right" Grid.Row="1"/>
</Grid>
</DataTemplate>
</GroupStyle.HeaderTemplate>
</GroupStyle>
</ListBox.GroupStyle>
我的資料系結到 SQL 服務器,我嘗試使用集合視圖
uj5u.com熱心網友回復:
的DataContextaGroupItem有一個Items包含所有分組專案的屬性,因此您應該能夠像這樣系結到組中專案的Note和orderid屬性:
<TextBlock x:Name="GrpDate" ... Text="{Binding Name}" />
<TextBlock x:Name="GrpNote" ... Text="{Binding Items[0].Note }" />
<TextBlock x:Name="GrpNote1" ... Text="{Binding Items[0].orderid }" />
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/440638.html
