Git Product home page Git Product logo

Comments (6)

Takoooooo avatar Takoooooo commented on May 14, 2024

This problem is related not to the master branch but to #8

from avalonia.controls.treedatagrid.

Takoooooo avatar Takoooooo commented on May 14, 2024

@danipen @miryamGSM Would it be possible for you guys to provide more info about this issue or some repro?
From my POV it's impossible for OnAttachingToLogicalTree to be called without creating of cell. So if cell is created this code makes sense and no additional validations are needed.

from avalonia.controls.treedatagrid.

danipen avatar danipen commented on May 14, 2024

Hi @Takoooooo, unfortunately I don't have a minimal example to reproduce this issue, and I'm afraid that it's not easy to build, since I'm not sure why/when it happens (it happens "sometimes" when switching from views, and re-creating the TreeDataGrid).

image

As you can see in the image, there are a unwanted state:

  • The method OnAttachedToLogicalTree is raising the event RaiseCellPrepared for row 0.
  • However, the TreeDataGrid has no rows at this moment (the _treeDataGrid.Rows collection is empty).

Is feasible to protect this scenario? Does it make sense for you?

from avalonia.controls.treedatagrid.

Takoooooo avatar Takoooooo commented on May 14, 2024

@danipen The problem is what protecting it doesn't really have a sense. OnAttachingToLogicalTree should not be called because we don't create any rows and the Rows collection is empty. I tried to make a test which would repro this but unsuccessfully. And also we cant just blindly protect that because it doesn't have a sense. I can only suggest you to make the repro or to protect from that locally in your code

from avalonia.controls.treedatagrid.

grokys avatar grokys commented on May 14, 2024

There's a repo of this on the repro-cases/wrong-index-raise-cell-prepared branch.

from avalonia.controls.treedatagrid.

grokys avatar grokys commented on May 14, 2024

Taken a look at the repro and the problem seems to be that:

  • TreeDataGridExpanderCell contains an "inner" cell that is used to display the cell data
  • When TreeDataGridExpanderCell gets realized, it calls UpdateContent to realize the inner cell, setting RowIndex/ColumnIndex
  • When TreeDataGridExpanderCell gets unrealized, UpdateContent gets called again, but it doesn't unrealize the inner cell because _model is already set to null here

I think we just need to remove that _model is null check in TreeDataGridExpanderCell.UpdateContent. think that when model is null we need to call Unrealize() on the inner cell.

from avalonia.controls.treedatagrid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.