Home Forums WPF controls Xceed DataGrid for WPF Repaint dataGrid

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

    Hi!

    I have one form whith the dataGrid, it contein a users. After double click of the row opening new form (user form) whith textBoxes. All textBox binding:

    binding.UpdateSourceTrigger = UpdateSourceTrigger.LostFocus

    If i Reject changes and close user form, dataGrid’s row not rejected.

    How repaint or renew dataGrid row?

    Imported from legacy forums. Posted by SkyFox (had 924 views)

    Xceed Support
    Member
    Post count: 5658

    You could try to call the Refresh method on the datagrid’s ItemsSource property, which will cause the grid to repaint itself.

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

    User (Old forums)
    Member
    Post count: 23064

    Whate a Refresh method?

    dataGrid ItemSourse is a DataTable.

    Imported from legacy forums. Posted by SkyFox (had 480 views)

    Xceed Support
    Member
    Post count: 5658

    Normally, the DataTable is wrapped in a CollectionView or a DataGridCollectionView. Cast the ItemsSource and call the view’s Refresh method:

    ( ( DataGridCollectionView )this.OrdersGrid.ItemsSource ).Refresh();

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

    User (Old forums)
    Member
    Post count: 23064

    no good 🙁
    Error
    “Unable to cast object of type ‘UsersDataTable’ to type ‘System.Windows.Data.CollectionView’.”

    Imported from legacy forums. Posted by SkyFox (had 884 views)

    Xceed Support
    Member
    Post count: 5658

    Can you post the code you are using the bind both the DataTable and Grid?

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

    User (Old forums)
    Member
    Post count: 23064

    grdUsers.ItemsSource = UserDataTable;

    UserDataTable is a class derived from DataTable.
    It was generated by VusualStudio’s dataset designer.

    Imported from legacy forums. Posted by SkyFox (had 525 views)

    Xceed Support
    Member
    Post count: 5658

    Try this:

    DataGridCollectionView view = new DataGridCollectionView( UserDataTable.DefaultView );
    grdUsers.ItemsSource = view;

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

    User (Old forums)
    Member
    Post count: 23064

    Thank’s it work!

    Imported from legacy forums. Posted by SkyFox (had 6296 views)

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