2

After searching for a few days, i thought maby someone can help me. I'm making a Windows form Application. And on one of my views i have a repeater with a label in there. This label is dynamicly sized. But My DataRepeater item won't adjust to the size of my label.

Has anyone a idea how to fix this?

The datarepeater i use is from the visual basic powerpacks. If any more Infromation is needed to help me, please let me know.

Regards Stephan

Spons
  • 1,593
  • 1
  • 17
  • 46
  • I have a simular issue. I have a dynamic User Control inside my Data Repeater, and every user control have a different size. – Gerhard Powell Apr 30 '12 at 14:53

1 Answers1

1

It looks like DataRepeater is very limited with regards to resizing. I found this website that it looks like they got it working, but all of the items resize to the same size.

http://social.msdn.microsoft.com/forums/en-US/vbpowerpacks/thread/c93579f2-8b4c-4002-9ce2-152e2dddd10e/

Edit: This solution is a little bit more complex, but VERY flexible: You can use a FlowLayoutPanel:

You create an User Control for the item on the list and add a Select Property to the User Control. You add a list of the User Controls to the FlowLayoutPanel. When the User Control change size, it automatically adjust everything in the FlowLayoutPanel. (Disable WrapContents to prevent Horizontal Scrolling)

http://msdn.microsoft.com/en-us/library/ms171633.aspx

You can use the following in the UserControl to enable Click on the User Control to select it: Click event for .Net (Windows Forms) user control

In the form that use the FlowLayoutPanel, you add the Click event, and then apply the Select to only that one User Control.

You can use the SetBoundsControl inside the User Control to set the size of the item.

Community
  • 1
  • 1
Gerhard Powell
  • 5,965
  • 5
  • 48
  • 59
  • I will try this as soon as possible. But i've try something like this. And it looked like it didn't change. At the moment i went in debug mode. I saw that all items resized but at the end of setting al repeater items they resized back to orginal state. – Spons May 01 '12 at 06:27
  • I've build in the Draw item solution from the first links.. and it looks like it works but... it gives the following exception on every draw: Collection was modified; enumeration operation may not execute. Any Ideas? – Spons May 01 '12 at 18:37
  • 1
    I'll Take the second solution... It isn't that hard to make and it saves you a lot of issues! Thank you for you help! – Spons May 01 '12 at 18:54