Home Forums WPF controls Xceed DataGrid for WPF DataGrid Database

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #25099 |

    hi ,
    I illustrate my problem:
    I have an application xbap (wpf) and i wont to load the data of the grid from a database.

    On windows application wpf source is :
    ————————————————————————-
    <-xaml->
    <WindowsFormsHost Margin=”28,118,23,44″>
    <wf:DataGrid x:Name=”dgvAnagrafica”></wf:DataGrid>
    </WindowsFormsHost>

    <-cs->
    bSourceAdapter dsa;
    dsa = new DbSourceAdapter();
    dgvAnagrafica.DataSource = dsa.CaricaTutti();
    ————————————————————————–
    as I do to load the data from the database with an application xbap using the grid
    <xcdg:DataGridControl x:Name=”grid”></xcdg:DataGridControl>
    I wont pololate this grid
    Help me 🙂
    Thanks

    Imported from legacy forums. Posted by marco (had 587 views)

    Xceed Support
    Member
    Post count: 5658

    You need to bind the grid to the data source by setting its ItemsSource property.

    Imported from legacy forums. Posted by Jenny [Xceed] (had 245 views)

    User (Old forums)
    Member
    Post count: 23064

    Thank your for replay.
    I tried this code :
    ————————————————————–
    DataTable dt = new DataTable();
    dt.Columns.Add(“col1”, typeof(string));
    dt.Columns.Add(“col2”, typeof(string));

    dt.Rows.Add(new object[]{“val 1”, “”});
    dt.Rows.Add(new object[] { “”, “val 1ewdsa” });
    dt.Rows.Add(new object[] { “val 4”, “val 1” });
    dt.Rows.Add(new object[] { “val 12”, “val 166” });
    dt.Rows.Add(new object[] { “val 1”, “val 121321” });

    grid.AutoCreateColumns = true;

    grid.ItemsSource =dt.Rows;
    —————————————————————
    But it dosn’t work.
    The grid display 4 fields:
    – RowError
    – RowState
    – Table
    – HasError

    Why ?

    Thaks

    Imported from legacy forums. Posted by marco (had 359 views)

    Xceed Support
    Member
    Post count: 5658

    Pass the datatable to the ItemsSource property and not the rows collection and your data should be displayed.

    Imported from legacy forums. Posted by Jenny [Xceed] (had 202 views)

    User (Old forums)
    Member
    Post count: 23064

    I have passed the data Table but retry an error: Data Table is not enumerable. Possible see an example

    Imported from legacy forums. Posted by marco (had 394 views)

    User (Old forums)
    Member
    Post count: 23064

    Check out <a href=”http://forums.xceed.com/forums/ShowPost.aspx?PostID=10018″>here</a&gt;

    Imported from legacy forums. Posted by nat (had 4799 views)

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.