[Version 2.0] Collapsed or hidden?

Aug 22, 2012 at 2:23 PM

Hi Adolfo, you've done a great work!

I've spent a bit to understand how to make this new version working: just having a look at your MVVM example was maybe not enough, an update to the tutorial would be greatly appreciated...

Anyway I've discovered at my expenses that if I set the visibility value of a LayoutAnchorableItem to Collapsed, instead of Hidden, I will not be able to restore its visibility.

I haven't had the time to check your code but it looks like that if the LayoutAnchorablePane has all its children with Visibility set to Collapsed than it disappears, and changing again that property for its children doesn't affect its visibility anymore.

Maybe it's just a feature that I don't understand... :)

Thanks again for your great work!

 

Aug 22, 2012 at 4:03 PM

Continuing to play with AD, now I've discovered that if I deserialize a layout in which I have hidden anchorables and, in the LayoutInitializer I add them to the LayoutAnchorablePane, their style is not loaded (the Style selector is never called).

I guess it's the correct behaviour but... there's a but... I'm controlling the Visibility of these LayoutAnchorableItems through the binding that is defined inside the style... so it's impossible for me to bring them to visible again cause the binding has not be set up.

What is the correct procedure to handle the Hidden items that we find in the serialized layout? Should I set them to visible just for them to load their style and then again to invisible once loaded?

Thank you

Aug 22, 2012 at 4:54 PM

Debugging a bit my code and your latest one, I've seen that my style and template selectors are called with the first parameter set to null for all the hidden anchorables found in the serialized layout.

The reason is that the Attach method of LayoutItem receives a LayoutContent with the property Content set to null and it assigns it to the Property Model, that is the one sent afterwards to the selector as the first parameter in the ApplyStyleToLayoutItem .

Now the next step would be to understand how the LayoutContent.Content should be filled and when....

Aug 22, 2012 at 5:38 PM

Totally my fault... If I read more carefully your commented source code in the MVVM demo, I would have noticed that you are indeed loading some content in the LayoutSerializationCallback.

That's the place where we have to load Content inside our LayoutAnchorables before the styles and template are applied...