private int[] g1 = new int[9];
public int[] G1
{
get { return g1; }
set { NotifyPropertyChanged("G1[]"); }
}
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(string propName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propName));
}
}
<TextBlock x:Name="R1G1" Text="{Binding G1[0]}" HorizontalAlignment="Left" Margin="0,0,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="80" Height="80"/>
G1 在一个方法中填充了从 1 到 9 的整数。
问题:文本块的文本设置为 0,无法更新。