Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
4133
How To Dynamically Change Width Of UIElement
posted

I have added a record count label to the grid with a creation filter.  I am showing the record count in the caption area of the grid and want to show it on the far right side.  However, as the record count changes, I would like to change the width of the UIElement accordingly.  I have other button in the same area and I would like them all to be aligned against the right side of the grid control.  I would like the record count to be the right-most UIElement.  Does anybody know how I can get this item to autosize?  I also need to adjust the position of all the other buttons whenever the record count button's size changes.

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    I'm not sure what you are asking. Which part of this are you having trouble with? 

    There's no way to autosize the element to it's context, you will need to measure the text. I beleive there are methods on the Infragistics.Win.DrawUtility which you can use in your CreationFilter to do this and then determine the rect of your element.

    In order to get the element to resize when the value changes, what you will need to do is get the CreationFilter to re-fire and re-crete the elements. One way to do this would be to call DirtyChildElements on the grid.DisplayLayout.UIElement. This dirties the UIElement hierarchy so that the grid will re-position the elements the next time it paints. 

     

Children