Home Forums WPF controls Xceed DataGrid for WPF Refresh problem when bound to a DataTable

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

    I am using v1.1 of the DataGrid. The grid is bound to a DataTable. The first column is an image column. When a “next page” button is clicked on the same page where the DataGrid is, I am updating the records in the bound DataTable. For some strange reason sometimes the grid fails to refresh when the DataTable is updated.

    <xcdg:DataGridControl x:Name=”OrdersGrid”
    AutoCreateColumns=”False”
    ItemsSource=”{Binding Path=ProbesTable}”
    ReadOnly=”True” SelectionMode=”Single”
    NavigationBehavior=”RowOnly”
    ItemScrollingBehavior=”Immediate”>
    <xcdg:DataGridControl.Columns>
    <xcdg:Column FieldName=”State” Width=”24″>
    <xcdg:Column.CellContentTemplate>
    <DataTemplate>
    <Image x:Name=”img” Source=”/art/DeleteHS.png” Stretch=”None” />
    <DataTemplate.Triggers>
    <DataTrigger Binding=”{Binding}” Value=”0″>
    <Setter TargetName=”img” Property=”Source” Value=”/art/eps_closedHS.png” />
    </DataTrigger>
    <DataTrigger Binding=”{Binding}” Value=”1″>
    <Setter TargetName=”img” Property=”Source” Value=”/art/eps_open_largelHS.png” />
    </DataTrigger>
    <DataTrigger Binding=”{Binding Mode=OneWay}” Value=”2″>
    <Setter TargetName=”img” Property=”Source” Value=”/art/RecordHS.png” />
    </DataTrigger>
    <DataTrigger Binding=”{Binding Mode=OneWay}” Value=”3″>
    <Setter TargetName=”img” Property=”Source” Value=”/art/Flag_greenHS.png” />
    </DataTrigger>
    </DataTemplate.Triggers>
    </DataTemplate>
    </xcdg:Column.CellContentTemplate>
    </xcdg:Column>
    <xcdg:Column FieldName=”CreationTime” Title=”Date Time” DisplayMemberBinding=”{Binding Path=CreationTime}”/>
    <xcdg:Column FieldName=”SourceId” Title=”Camera” DisplayMemberBinding=”{Binding Path=SourceId}”/>
    <xcdg:Column FieldName=”ServerName” Width=”500″ Title=”BranchName” DisplayMemberBinding=”{Binding Path=ServerName}”/>
    <xcdg:Column FieldName=”MaxScore” Title=”Score” DisplayMemberBinding=”{Binding Path=MaxScore}”/>
    </xcdg:DataGridControl.Columns>

    </xcdg:DataGridControl>

    Is there a way to forcefully refresh the grid without relying on the notification event?

    Imported from legacy forums. Posted by Ferents (had 3059 views)

    User (Old forums)
    Member
    Post count: 23064

    i recently hat almost the same problem because i did not set the DisplayMemberBinding for the columns. think that could be the reason why your’s is not working too.
    grid.Items.Refresh() should work to forcefully refresh, but it would be better to get it work the richt way.

    Hth
    Silas

    Imported from legacy forums. Posted by Ralf (had 228 views)

    User (Old forums)
    Member
    Post count: 23064

    You say that “sometimes”, the grid fails to refresh when the DataTable is updated. Could you elaborate on that?

    Have you noticed any pattern of when it fails and when it works?

    Would it be possible for you to send us a repro app to support@xceedsoft.com?

    Thanks!

    Imported from legacy forums. Posted by Pascal (had 454 views)

    User (Old forums)
    Member
    Post count: 23064

    The DataTable is shared among more then one pages. On most of the pages I use the default view (ICollectionView) of the DataTable to scroll.
    On the page where the DataGrid is, there are other fields bound to the current item of the default view (ICollectionView) of the DataTable.
    When DataTable refreshed, the controls that are bound to the default view are updated correctly. However, after refreshing the DataTable, the ‘Items’ property of the grid doest change. Therefore grid.Items.Refresh() doesn’t refresh the grid. So fare I don’t see why and when this happens.

    Imported from legacy forums. Posted by Ferents (had 4277 views)

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