Observablecollection not updating datagrid

For example, a Stack Panel arranges its children sequentially, beginning with the first child and stacking subsequent children one right after the other.

However, a Loop Panel really eases the concept of a “first” child. The pivotal child is the element around which the remaining children are arranged. Then its neighboring siblings (the subsequent and preceding members of the children collection) are placed, working away from the pivotal child in both directions until all remaining visible children are arranged.

observablecollection not updating datagrid-21observablecollection not updating datagrid-67observablecollection not updating datagrid-35

This allows for a balanced layout around the pivotal child.

Nonvisible children (those that are outside the panel’s viewport) are then arranged using a layout rect with no size (both width and height are zero).

If you are actually developing for Surface, be sure to check out the , I would highly recommend it as a foundation for this article.

The Loop Panel Sample Application To give you a better understanding of the panel examined within this post, you can run this Click Once Loop Panel sample application.

The Loop Panel Layout Algorithm Whenever I’m creating a new panel, I start by clearly defining its layout algorithm.

This allows me to identify the exact properties that will be necessary to support the new layout.

In the Loop Panel class, I wanted to support both a horizontal and vertical orientation, just as Stack Panel does.

I also decided to use the same basic measuring algorithm as Stack Panel, measuring each child to infinity in the stacking direction (the orientation direction) and measuring it to the panel’s available size in the nonstacking direction.

I had some extra time this weekend, so I refactored one of my early looping panels into something that might be useful for a wider audience.

Tags: , ,