Hi
Can i get the width of certain column of an ultrapivot grid? Or the width of a certain cell?
Are those widths resizeable?
Thanks!
Hello,
Thank you for posting in our forums.
The UltraPivotGrid has a columns collection and you can get the widths of each of the columns from there.
You can also set this width to resize it programmatically, or set the AllowColumnResize property to enable/disable letting the user resize it through the UI.
If you need further assistance with this, please let me know.
Thanks!The goal was to get the point in red circle in the file attached. Do you know how can i get it?
Thanks!!
Hi Zigor,
Sorry this case fell off our radar because it was closed a couple weeks ago.
I'd be happy to help you try to achieve what you want here. But I need more information in order to understand what that is. The point you show in your screen shot it kind've arbitrary. So I need more details about the criteria you are trying to use and what you are trying to do. Are you trying to trap for a click or a MouseOver in order to imlpement some user-interaction with the PivotGrid? Or are you trying to draw something there?
What if the user changes things around and uses other fields? How will you know what the correct point is?
You can get the UIElement of the PivotGrid outside of a CreationFilter. The control itself exposes a UIElement property which returns the main UIElement and you could walk down the tree using the ChildElements property of that. Or you can use ElementFromPoint to get the element at a particular point relative to the control.
First of all, thanks for the reply.I´m afraid that we aren´t doing a very orthodox use of the component.We want to put some labels above the first fixed row "IT11, IT12, IT21, IT22". The position of the labels is based on the position marked in red in the picture.To get what we want we need that point. Or, at least, the width of the left fixed columns. In this case, the ones with the text "ARCAS" and "KWFH/TVFa". If something changes, just accessing to these widths will solve again the initial position of the red point.Hope I have explained it better ;)Thanks!
I don't think that's possible. A CreationFilter can allow you to modify the position, size, or contents of a UIElement. But inserting an additional row would be extremely diffficult, because you would have to move essentially every other element in the entire grid in order to *** everything else down. Since the CreationFilter only affect the painting of the control and not the actual metrics, this would, in turn, cause the scrollbars not to function properly. Maybe I a misunderstanding what you want, though. If you are just talking about placing a Label control or something like it on top of the PivotGrid at a particular position, without moving any of the objects in the PivotGrid itself, then that might be doable.
But again, the criteria is a little tricky. You seem to be suggesting that your PivotGrid is fixed and that the user cannot change which columns you are using. If that's the case, and you will ALWAYS be using IT11 and IT12 and the same grouping, then it might be doable. Is that the case? Could you post a screen shot that mocks up what you want?
I just need the distance of the width of the Measure column or the the width of the left fixed columns or the width of the Group_Y_1 column. The three of the are the same distance. Take a look at the picture.
Okay. I'm trying to explain that it's probably not that simple. How you get the width depends a lot on WHEN you need to get it and what you are going to do with it.
But if you are not interested in any of that and you just want to get the width, you can probably use a CreationFilter like this:
this.ultraPivotGrid1.CreationFilter = new MyCreationFilter(); class MyCreationFilter : IUIElementCreationFilter { void IUIElementCreationFilter.AfterCreateChildElements(UIElement parent) { if (parent is UltraPivotGridUIElement) { var rowDropAreaUIElement = parent.GetDescendant(typeof(RowDropAreaUIElement)); if (null != rowDropAreaUIElement) Debug.WriteLine(rowDropAreaUIElement.Rect.Right); } } bool IUIElementCreationFilter.BeforeCreateChildElements(UIElement parent) { // Do nothing return false; } }
Excellent. Glad you finally got it working. :)
Hi Mike!
Looks that the creation filter you send me works!
Thanks for the help! And again, for your patience.
No problem. Let me know how it goes.
Hi again and sorry for the time jumps. I am travelling a lot.
Mike Saltzman said:I thought you were trying to position a label or some other control on top of the UltraPivotGrid, in which case, the CreationFilter would actually work. The code I have here will fire any time the RowDropAreaUIElement gets positioned, so you could use that position to place some other control if that's what you want.
Yes, that is what we want. I haven't had time for trying again the creation filter. I'll try it this week and tell you if it works.
Thanks for the help. Thanks for the patience.
As I was trying to explain initially... in order to help you with this, I really need to know what you are trying to do with this information. Why do you want the width of this element? What are you trying to use it for?
I thought you were trying to position a label or some other control on top of the UltraPivotGrid, in which case, the CreationFilter would actually work. The code I have here will fire any time the RowDropAreaUIElement gets positioned, so you could use that position to place some other control if that's what you want.
If you want to use the Paint event, or after-draw, then you could could use a DrawFilter or derive a control from the PivotGrid and then override OnPaint and then do whatever you want to do after you call the base implementation.
But there are really too many possibilities here for me to help you intelligently without know what you are trying to do.