Resize repeater selected item?

A place for App developers to hang out / post
Post Reply
MrNorth

Posts: 60
Joined: Sat May 18, 2013 9:46 am
Location:

HTPC Specs: Show details

Resize repeater selected item?

#1

Post by MrNorth » Fri Jan 31, 2014 3:43 pm

Hi!

The wonders of MCML are still causing major headache.

I have a simple vertical repeater. The item template is a simple panel with two texts in a vertical flow like

panel
text1
test2
end panel

When the item is in focus I want both texts to be visible (hence the item will grow vertically, pushing the items below down a bit). When the item is not in focus, I want to show only one text.

I have spent the past 4 hours trying to make this work. Can it be done??? The "problem" seems to be that MCML is very poor at adapting size dynamically based on content, something I am very used to in WPF or HTML. It seems as if my item root panel MUST have a maximumsize value to be set for it to be displayed, and this cant be set to a dynamic value. For example, if I set the MaximumSize to 600,30 the item will be 30 pixels in height, no matter the content. I tried to change this value using a rule but then the UI freaked out. And it is very strange why the "maximumvalue" is a fixed width. It is more logical if this would be a top value, meaning that the size of the content can be anything from 0 to maximumvalue. But if I set maximumvalue to 30, the item takes up 30 pixels in the repeater, even if the content only occupy 20 pixels

My other option was to create a root panel without this maximumsize set and then add two childred panels with maximumsizevalues set to 600,30 for not focused item and 600,80 for focused value. Nothing is displayed. So, obviously the root item in a repeater MUST have the maximumsize value set to a static value, and it seems very hard to make it grow dynamically, based on the focused content.

rootpanel
childpanel1
text
end childpanel1
childpanel2
text1
text2
end childpanel2
end rootpanel

The above solution doesn't work, since the renderer is ONLY using the freaking maximumsize of rootpanel. And this value can't be omitted.

How can I do this?????? It is possible, since they are doing it in the netflix episodes list. But I can't figure out how????? I have read on the sandbox that some dude solved it using two panels which he made visible/not visible (he provided no understandable solution). I have tried that too, but since I don't know how to escape the requirement of the item root panel must have a static maximumsize set, the solution has eluded me.

How nice it would be if maximumsize could be set to *, and make the item resize itself based on content :)

HELP!

MrNorth

Posts: 60
Joined: Sat May 18, 2013 9:46 am
Location:

HTPC Specs: Show details

#2

Post by MrNorth » Fri Jan 31, 2014 3:52 pm

Oh yeah I forgot.

According to documentation for the MaximumSize element, setting either x or y to 0 will cause it to have no restriction...

They seem to have forgot to update the documentation, since when I try to set the blow value for a panel

MaximumSize="600,0"

I get a "dividebyzeroexception" :)

The xml schema allow me to set this value, but at runtime it causes an internal crash.

MCML never ceases to amaze me.

sccrgoalie1

Posts: 317
Joined: Fri Jul 08, 2011 5:52 pm
Location:

HTPC Specs: Show details

#3

Post by sccrgoalie1 » Fri Jan 31, 2014 4:36 pm

Posting the actual MCML would be helpful, because it's unclear what your true issue is. You can set Maximum Size to this for example MaximumSize="0,400", as I do stuff like that in my project all the time with no issue. Have you tried using a minimum size?

Something else is causing your divide by 0 exception.

MrNorth

Posts: 60
Joined: Sat May 18, 2013 9:46 am
Location:

HTPC Specs: Show details

#4

Post by MrNorth » Sat Feb 01, 2014 9:42 am

sccrgoalie1 wrote:Posting the actual MCML would be helpful, because it's unclear what your true issue is. You can set Maximum Size to this for example MaximumSize="0,400", as I do stuff like that in my project all the time with no issue. Have you tried using a minimum size?

Something else is causing your divide by 0 exception.
Hi!

After countless hours I decided to remove all the MCML for this scroller and restart from scratch, using a flowlayout and not the formlayout. Now things became much better, no ned to worry about the maximumsize attribute, and the very strange dividebyzero problem disappeared as well. Now the MCML behaves like it should.

I guess I just made the design overcomplicated, mainly because I feel like I have more control of things when using formlayout. But with a little fiddling, I managed to make it look just as good with maybe only 30 % of the lines of code. Maybe too many nested formlayouts combined with an overly complicated layout in general caused these issues. I am used to the fact that both MCML and XAML for that matter can produce strange errors. Not often, but they are there... and this dividebyzero was by far the most strange thing I have seen. If this was 2008, MSFT would be very interested in my error report, I reckon!

Problem solved, moving on. Thanks for commenting!!!

/H :clap:

Post Reply