1
以下是我在網格視圖中的物料模板。在網格可觀察集合中顯示網格物料位置編號
</Grid.ColumnDefinitions>
<StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding SerialNumber}" VerticalAlignment="Center" HorizontalAlignment="Left" FontWeight="Bold" Margin="10" FontSize="25"/>
<TextBlock Text="." VerticalAlignment="Center" HorizontalAlignment="Left" FontWeight="Bold" FontSize="25" />
</StackPanel>
<Image Grid.Column="0" Margin="20" Height="100" Width="150" HorizontalAlignment="Center" Source="{Binding ImageUri,Mode=TwoWay}" VerticalAlignment="Center"/>
</StackPanel>
</Border>
</DataTemplate>
</GridView.ItemTemplate>
什麼,我想實現的是顯示在TextBlock的文本集合中的項目位置=「{結合的SerialNumber}(如果這是一個列表視圖,它會。將行號),請我如何做到這一點
@澤維爾謝,做ü提供幫助更新時,曾經的項目是從觀察集合刪除的ObservableCollection行號解決?如果沒有的話,關於如何去做的任何想法。 –
如果你刪除了項目,你需要自己更新'SerialNumber'。請參閱我的更新回覆。我註冊了'CollectionChanged'事件來更新SerialNumber,並使'Test'類繼承自[INotifyPropertyChanged](https://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged(v = vs。 110)的.aspx)。它用於通知UI SerialNumber已更新。 –
完美 –