1
ねえGUS私が持っているボタン:SilverlightのDataGridが結合しない
GetData();
dataGrid1.ItemsSource = DriverCollection.ToList();
私は(私のコレクションは2行を含む)、空と非常に狭いである2つの行を追加充填しない、それをデータグリッドをクリックすると
private ObservableCollection<DriverData> _DriverCollection = new ObservableCollection<DriverData>();
private ObservableCollection<DriverData> DriverCollection
{
get { return _DriverCollection; }
}
:これは私のクラス
private class DriverData
{
public string DriverName { get; set; }
public decimal DriverSalary { get; set; }
}
コレクションです
GetDataメソッドを正しく収集が二列に充填され< <その作品:
for (int i = 0; i < FilteredDriverNamesList.Count; i++)
{
_DriverCollection.Add(new DriverData { DriverName = FilteredDriverNamesList[i], DriverSalary = _DriverSalarys[i] });
}
とグリッド:
<sdk:DataGrid AutoGenerateColumns="False" Name="dataGrid1" FontSize="14" Margin="12,0,0,0"
HorizontalAlignment="Left" Width="549" Height="273" VerticalAlignment="Top" ItemsSource="{Binding DriverCollection}">
<sdk:DataGrid.Columns>
<sdk:DataGridTextColumn Binding="{Binding DriverName}" Width="200"/>
<sdk:DataGridTextColumn Binding="{Binding DriverSalary}" Width="140"/>
</sdk:DataGrid.Columns>
</sdk:DataGrid>
編集:私は、私はパブリックとプライベート編集した問題を解決しましたあなたのクラスで ありがとう
明確な質問です。 – codeSetter