【问题标题】:Refresh the only object in ObjectListView刷新 ObjectListView 中唯一的对象
【发布时间】:2011-06-16 13:58:04
【问题描述】:

我使用ObjectListView。并使用方法 RefreshObject() 更新唯一修改的对象。

// The difference between associations and updatedAssociations is only in 
// one item, which ID field remains the same. 
// So i find an updated item by ID in the associations (before updating). 
//And say Object ListView to to refresh this item. 

var associationToUpdate = associations.References.Where(
        x => x.ID == associationIDToUpdate).FirstOrDefault();

olvAssociations.RefreshObject(associationToUpdate);

// And only after this set the model to updated model

associations = updatedAssociations;

但是什么也没发生。有人知道这是怎么回事吗?

【问题讨论】:

    标签: c# objectlistview


    【解决方案1】:

    olv 也很适合我。我了解您在 objectlistview 临时编辑之外更新您的模型吗?您刷新的功能旨在通过在 objectlistview 本身中进行的编辑来强制更新模型。

    如果您在视图之外更新模型,objectlistview 表示它会自动更新显示。该陈述与我无关,但我仍在研究中。如果我找到一个好的解决方案,我会在这里更新。

    objectlistview, interesting feature - search for "After the update"

    编辑:

    我还没有找到适合我的答案,但这些可能适合你:

    objectlistview, 2 force-redraw functions

    【讨论】:

      【解决方案2】:

      我想你正在寻找:

      objectListView.RefreshItem(item);
      

      【讨论】:

      • RefreshItem() 可用于手动更新 OLVListItem。但 OP 正在尝试更新模型。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-05
      • 2013-04-16
      相关资源
      最近更新 更多