Home Forums WPF controls Xceed DataGrid for WPF ItemSource Changing Problem

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

    Hi I’m new on using Xceed DataGrid for WPF.

    I’m using the lastest version (v1.1 service) and having a little problem with using it.

    Once I set the ItemSource with a DataTableView it work fine at the first time, but after the first setting then I set it again the data dispears.

    The code looks like this:

    public delegate void UpdateView1Delegate(System.Data.DataTable CurrentDataTable);

    public void UpdateView1(System.Data.DataTable CurrentDataTable)
    {
    this.CurrentDataGrid1.ItemsSource = CurrentDataTable.DefaultView;
    this.CurrentDataGrid1.Items.Refresh();
    }

    public void OnSearchClick(Object sender, RoutedEventArgs args)
    {

    CurrentUsingDataTable = Pintrus.XTraffic.Database.DBQueryForNCM.GetPolicyHistoryByCondition();

    this.Dispatcher.BeginInvoke(
    System.Windows.Threading.DispatcherPriority.SystemIdle,
    new UpdateViewDelegate(UpdateView), this.CurrentUsingDataTable);
    }

    When the Search Button is clicked the OnSearchClick function hires, the first time it works, but after that the data disapears even theres data. The VS prints out follow:

    System.Windows.Data Error: 12 : Cannot get ‘0’ value (type ‘Int32’) from ” (type ‘DataRowView’). BindingExpression:Path=0; DataItem=’DataRowView’ (HashCode=28436463); target element is ‘DataRow’ (Name=”); target property is ‘TitleBarContent’ (type ‘Object’) ArgumentException:’System.ArgumentException: ‘ID’ 열은 PolicyHisDetail 테이블에 속하지 않습니다.
    > 위치: System.Data.DataRow.CheckColumn(DataColumn column)
    > 위치: System.Data.DataRowView.GetColumnValue(DataColumn column)
    > 위치: MS.Internal.Data.ValueTable.GetValue(Object item, PropertyDescriptor pd)
    > 위치: MS.Internal.Data.PropertyPathWorker.GetValue(Object item, Int32 level)
    > 위치: MS.Internal.Data.PropertyPathWorker.RawValue(Int32 k)’
    >System.Windows.Data Error: 12 : Cannot get ‘0’ value (type ‘Int32’) from ” (type ‘DataRowView’). BindingExpression:Path=0; DataItem=’DataRowView’ (HashCode=28436463); target element is ‘DataCell’ (Name=”); target property is ‘Content’ (type ‘Object’) ArgumentException:’System.ArgumentException: ‘ID’ 열은 PolicyHisDetail 테이블에 속하지 않습니다.
    > 위치: System.Data.DataRow.CheckColumn(DataColumn column)
    > 위치: System.Data.DataRowView.GetColumnValue(DataColumn column)
    > 위치: MS.Internal.Data.ValueTable.GetValue(Object item, PropertyDescriptor pd)
    > 위치: MS.Internal.Data.PropertyPathWorker.GetValue(Object item, Int32 level)
    > 위치: MS.Internal.Data.PropertyPathWorker.RawValue(Int32 k)’
    >System.Windows.Data Error: 12 : Cannot get ‘0’ value (type ‘String’) from ” (type ‘DataRowView’). BindingExpression:Path=0; DataItem=’DataRowView’ (HashCode=28436463); target element is ‘DataCell’ (Name=”); target property is ‘Content’ (type ‘Object’) ArgumentException:’System.ArgumentException: ‘POLICY_APPLY_NAME’ 열은 PolicyHisDetail 테이블에 속하지 않습니다.
    > 위치: System.Data.DataRow.CheckColumn(DataColumn column)
    > 위치: System.Data.DataRowView.GetColumnValue(DataColumn column)
    > 위치: MS.Internal.Data.ValueTable.GetValue(Object item, PropertyDescriptor pd)
    > 위치: MS.Internal.Data.PropertyPathWorker.GetValue(Object item, Int32 level)
    > 위치: MS.Internal.Data.PropertyPathWorker.RawValue(Int32 k)’
    >System.Windows.Data Error: 12 : Cannot get ‘0’ value (type ‘String’) from ” (type ‘DataRowView’). BindingExpression:Path=0; DataItem=’DataRowView’ (HashCode=28436463); target element is ‘DataCell’ (Name=”); target property is ‘Content’ (type ‘Object’) ArgumentException:’System.ArgumentException: ‘POLICY_CATEGORY’ 열은 PolicyHisDetail 테이블에 속하지 않습니다.
    > 위치: System.Data.DataRow.CheckColumn(DataColumn column)
    > 위치: System.Data.DataRowView.GetColumnValue(DataColumn column)
    > 위치: MS.Internal.Data.ValueTable.GetValue(Object item, PropertyDescriptor pd)
    > 위치: MS.Internal.Data.PropertyPathWorker.GetValue(Object item, Int32 level)
    > 위치: MS.Internal.Data.PropertyPathWorker.RawValue(Int32 k)’
    >System.Windows.Data Error: 12 : Cannot get ‘0’ value (type ‘String’) from ” (type ‘DataRowView’). BindingExpression:Path=0; DataItem=’DataRowView’ (HashCode=28436463); target element is ‘DataCell’ (Name=”); target property is ‘Content’ (type ‘Object’) ArgumentException:’System.ArgumentException: ‘NETWORK_AREA’ 열은 PolicyHisDetail 테이블에 속하지 않습니다.
    > 위치: System.Data.DataRow.CheckColumn(DataColumn column)
    > 위치: System.Data.DataRowView.GetColumnValue(DataColumn column)
    > 위치: MS.Internal.Data.ValueTable.GetValue(Object item, PropertyDescriptor pd)
    > 위치: MS.Internal.Data.PropertyPathWorker.GetValue(Object item, Int32 level)
    > 위치: MS.Internal.Data.PropertyPathWorker.RawValue(Int32 k)’
    >System.Windows.Data Error: 12 : Cannot get ‘0’ value (type ‘String’) from ” (type ‘DataRowView’). BindingExpression:Path=0; DataItem=’DataRowView’ (HashCode=28436463); target element is ‘DataCell’ (Name=”); target property is ‘Content’ (type ‘Object’) ArgumentException:’System.ArgumentException: ‘REGISTER_TIME’ 열은 PolicyHisDetail 테이블에 속하지 않습니다.
    > 위치: System.Data.DataRow.CheckColumn(DataColumn column)
    > 위치: System.Data.DataRowView.GetColumnValue(DataColumn column)
    > 위치: MS.Internal.Data.ValueTable.GetValue(Object item, PropertyDescriptor pd)
    > 위치: MS.Internal.Data.PropertyPathWorker.GetValue(Object item, Int32 level)
    > 위치: MS.Internal.Data.PropertyPathWorker.RawValue(Int32 k)’
    >System.Windows.Data Error: 12 : Cannot get ‘0’ value (type ‘String’) from ” (type ‘Da

    Imported from legacy forums. Posted by JunHeeLee (had 5484 views)

    User (Old forums)
    Member
    Post count: 23064

    After reading the TabControl Post (<a href=”http://forums.xceed.com/forums/ShowPost.aspx?PostID=7792″>Here</a&gt;) I realize my codes are in a TabControl. Some time the data even doesn’t appear. The sorting doesn’t work. (When I press the column button the data disappears… m.m)

    Imported from legacy forums. Posted by JunHeeLee (had 664 views)

    Xceed Support
    Member
    Post count: 5658

    I advise installing the lastest service release (released on May 30th)… The issue concerning the TabControl was addressed in that release.

    Imported from legacy forums. Posted by Marcus [Xceed] (had 417 views)

    User (Old forums)
    Member
    Post count: 23064

    Hello,

    I have the same problem as described in the first post.
    I have a very simple grid bound to a DataGridCollectionViewSource which is bound to a DataTable.
    The first time I set the DataTable everything works fine and the data is displayed. When I switch the table (assign different DataTable) the grid display the right number of rows but no data inside.

    I have read through the TabControl thread and it does not seem to solve my problem.
    I am using Xceed WPF Grid version 1.3.

    To make my case clearer, if I leave the same instance of DataTable and clear the rows and merge different table – everything works fine. So as long as the same instance of DataTable is left everything works fine.

    Ido.

    Imported from legacy forums. Posted by Ido (had 763 views)

    Xceed Support
    Member
    Post count: 5658

    If you scroll horizontally, do you see another set of columns with data in it?

    If the answer is yes, you will have to clear the columns before changing the ItemsSource.

    This is because when an ItemSource changes, we do not remove any columns from the collection. When assigning another table (even with the same column names), the column isntances in the datatable are not the same and are re-detected.

    Imported from legacy forums. Posted by Marcus [Xceed] (had 4399 views)

    User (Old forums)
    Member
    Post count: 23064

    I have the same problem version 3.5.9460.14460.

    When I first set ItemsSource everrything is OK, But when I Update ItemsSource there “Empty Set”. Not really empty, there are correct numbers of White rows 🙁 

    Imported from legacy forums. Posted by Leonid (had 732 views)

    User (Old forums)
    Member
    Post count: 23064
    Hello.
    Is this bug fixed in version 3.6?

    Imported from legacy forums. Posted by Leonid (had 528 views)

    User (Old forums)
    Member
    Post count: 23064

    I am having the same issue.  Clearing the columns doesn’t seem to help.  I’ve tried both versions 3.5.9616.13400 and 3.6.10159.15470.

    Imported from legacy forums. Posted by Bilbo (had 395 views)

    User (Old forums)
    Member
    Post count: 23064

    I found a work around.  On refresh, I call:

    myGrid.DetailConfiguration.Clear();

    before setting the new ItemsSource.  I’ll post on the other threads too.

     

    Imported from legacy forums. Posted by Bilbo (had 2027 views)

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