StrataListView - Do not clean the items


Author
Message
Rogerio Mauri
Rogerio Mauri
StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)
Group: StrataFrame Users
Posts: 205, Visits: 629
Ivan... Boa Tarde... Poderia traduzir? Grato...

Um cliente havia relatado o problema, mas só agora me deparei com ele.

Utilizando o StrataListView para exibir os registros relacionados. Quando o BO principal é movimentado rapidamente o StrataListView não limpa os itens do relacionamento anterior, duplicando as linhas.

Código envolvido:

private void tbBO1_Navigated(MicroFour.StrataFrame.Business.NavigatedEventArgs e)
{
     ReadBOFilho();
}

private void ReadBOFilho()
{

     LimpaGrade();
     tbFilhoBO1.FillByParentPrimaryKey(tbBO1.id);
     if (tbFilhoBO1.Count > 0) CarregaGrade();

}

private void LimpaGrade()
{
    Cursor.Current = Cursors.WaitCursor;
    strataListView1.BeginUpdate();
    strataListView1.Items.Clear();
    strataListView1.Groups.Clear();
    strataListView1.EndUpdate();
    Application.DoEvents();

}

private void CarregaGrade()
{
    Cursor.Current = Cursors.WaitCursor;
    strataListview1.BeginUpdate();
    StrataListViewItem item;
    StrataListViewSubItem subitem;
    if (tbFilhoBO1.Count > 0)
    {
          tbFilhoBO1.MoveFirst();
          do
          {
             item = new StrataListViewItem(string.Empty, "folder26.png");
             item.SubItems.Add(tbFilhoBO1.NomeCadastro);
             ...
             ...
             strataListView1.Items.Add(item);

          } while (tbFilhoBO1.MoveNext());
    }
    strataListView1.Sort(1, MicroFour.StrataFrame.UI.Rendering.Enums.StrataSortDirection.Ascending);
    strataListView1.EndUpdate();
    item = null;
    subitem = null;
    Application.DoEvents();


}

Rogério Mauri Smile

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Olá Rogério.

Eu acho que os seus "DoEvents" são os grandes responsáveis pelo que está acontecendo.

Abraços.

Ivan
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search