DataGrid行空

时间:2015-05-09 07:01:39

标签: c# wpf datagrid

新手在这里,但在DataGrid(WPF)和ItemSource列表中丢失了......

public MainWindow()         {

        InitializeComponent();
        string item = null;

        List<Car> auta = new List<Car>();    

        //string Maker, string typer, string body_typer, string colorr, int year_of_maker, int kwr, string equip_levelr, decimal pricer, string extrasr
        auta.Add(new Car("Skoda", "Octavia", "Sedan", "White", "1999", " 110", "Classic", " 1999", "Defend-Lock"));
        //auticka.Add(new Car("Skoda", "Octavia", "Sedan", "White", 1999, 110, "Classic", 1999, "Defend-Lock"));



         GridNamedats.ItemsSource = auta;

现在DataGrid XAML:

{
 <DataGrid x:Name=" GridNamedats" Margin="0,71,0,0" SelectionChanged="DataGrid_SelectionChanged" ColumnWidth="SizeToHeader" Grid.ColumnSpan="3">
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{x:Null}" ClipboardContentBinding="{x:Null}" Header="Make" Width="70"/>
                <DataGridTextColumn Binding="{x:Null}" ClipboardContentBinding="{x:Null}" Header="Type" Width="70" Foreground="#FFBBBBBB"/>
                <DataGridTextColumn Binding="{x:Null}" ClipboardContentBinding="{x:Null}" Header="Body Type" Width="70"/>
                <DataGridTextColumn Binding="{x:Null}" ClipboardContentBinding="{x:Null}" Header="Color" Width="70" Foreground="#FFBBBBBB"/>
                <DataGridTextColumn Binding="{x:Null}" ClipboardContentBinding="{x:Null}" Header="Year of Make"/>
                <DataGridTextColumn Binding="{x:Null}" ClipboardContentBinding="{x:Null}" Header="[KW]" Foreground="#FFBBBBBB"/>
                <DataGridTextColumn Binding="{x:Null}" ClipboardContentBinding="{x:Null}" Header="Equip Level" Width="100"/>
                <DataGridTextColumn Binding="{x:Null}" ClipboardContentBinding="{x:Null}" Header="Price [€]" Width="70" Foreground="#FFBBBBBB"/>
                <DataGridTextColumn Binding="{x:Null}" ClipboardContentBinding="{x:Null}" Header="Extras" Width="160"/>
                <DataGridTextColumn Foreground="#FFBBBBBB"/>
            </DataGrid.Columns>
        </DataGrid>

}

问题是DataGrid在行中有空单元格。在Car类中,当然有Constructor,getters + Setters

非常感谢您的建议! Oblud

1 个答案:

答案 0 :(得分:0)

尝试在您P s v m(Str args) { go: for(;;){ fact: for(int i=1;i<3;i++) { s.o.p(i); } } } 的{​​{1}}属性中添加媒体资源名称。

替换它:

while((count = in.read(byteBuffer, 0, BUFSIZE)) != -1) { // read from origin's buffer into byteBuffer until origin is out of data
     add logic here to print count
     add logic here to print the content of the byteBuffer 
}

用这个:

Binding

您可以在上述声明中提出您的属性名称。 DataGrid属性仅用于示例目的。