1

Possible Duplicate:
Getting Actual Size of UserControl before rendering
How to override MeasureOverride to find the size of ItemsControl

I had asked a question before which essentially boils down to:

How can I get the actual size of a UserControl having an ItemsControl to which items are dynamically added?

I tried overriding MeasureOverride as suggested here, but it is not helping.

Community
  • 1
  • 1
blitzkriegz
  • 9,258
  • 18
  • 60
  • 71

2 Answers2

0

Not sure, but look at the ActualHeight and ActualWidth properties:

http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.actualheight.aspx

Dave Clemmer
  • 3,741
  • 12
  • 49
  • 72
granaker
  • 1,318
  • 8
  • 13
  • `ActualHeight` and `ActualWidth` are not calculated until after the controls have been rendered. Based on the linked question, I think the OP wants to get the size before they get rendered. – Rachel Jan 13 '12 at 14:45
0

I allways wait for the sizechanged event of the control for which I need the ActualHeight and the ActualWidth properties.

So, hookup this event to your user control and then react in handler on e.NewSize.

Dave Clemmer
  • 3,741
  • 12
  • 49
  • 72
aerkain
  • 592
  • 1
  • 4
  • 16