Hello,
I've succesfully added buttons in the header of a UltraExpandableGroupBox with a creation filter, using the example on this site. However, now I need to have a track bar in the header. This doesn't seem to work as expected. When I add it, I can see the track bar in the header, but it doesn't repaint when I change it's value. When I drag the entire form out of the screen and back, I can see the value has actually changed.
I've tried all kinds of solutions. Refreshing / invalidating the trackbar, the element, etc. Can someone help me make this work? I would like to use the creation filter, because I already use it for adding buttons in my original project. Below is some sample code. Create an application "GroupBoxWithTrackBar" and add an UltraExpandableGroupBox to the form. Then override Form1.cs with the code below. I'm using version 10.3.20103.2145. Thanks in advance.
using System; using System.Windows.Forms; using Infragistics.Win; using Infragistics.Win.Misc; using Infragistics.Win.UltraWinEditors; namespace GroupBoxWithTrackBar { public partial class Form1 : Form { public Form1() { InitializeComponent(); } protected override void OnLoad(EventArgs e) { base.OnLoad(e); ultraExpandableGroupBox1.CreationFilter = new TrackBarCreationFilter(); } } public class TrackBarCreationFilter : IUIElementCreationFilter { private readonly UltraTrackBar TrackBar; public TrackBarCreationFilter() { TrackBar = new UltraTrackBar(); } #region IUIElementCreationFilter Members public void AfterCreateChildElements(UIElement parent) { if (!(parent is GroupBoxHeaderUIElement)) return; var rect = parent.Rect; rect.X += rect.Width - 100; rect.Width = 90; TrackBar.UIElement.Rect = rect; parent.ChildElements.Add(TrackBar.UIElement); } public bool BeforeCreateChildElements(UIElement parent) { return false; } #endregion } }
It may not be possible to make this work. You could try calling DirtyChildElement on the trackbar UIElement. But there maybe be other factors that the element needs in order to function, or internal members that have to be dirtied which you do no have access to.
Why not simply position an UltraTrackBar control over the header instead?
Mike Saltzman said:You could try calling DirtyChildElement on the trackbar UIElement.
Mike Saltzman said:Why not simply position an UltraTrackBar control over the header instead?
The same could be said for adding buttons, but this was suggested in this thread. Furthermore, like I said, I already have buttons added using a creation filter in my project, so it would be nice if I could keep the code consistent. But if it's not possible, then I will have to do it the way you suggested.
Thanks.
Hi,
Well, buttons are a little simpler than a trackbar.
But if you can post a small sample project demonstrating what you have so far, I would be happy to take a look at it and see if I can figure out why it's not working.
Thank you for your feedback!
Feel free to update the thread if you have any questions.
Unfortunately, I did not have time to try it out in our project yet. But as I mentioned, if I encounter any issues, I will post them here. Thanks!
I am just checking about the progress of this issue. Let me know if you need our further assistance on it.
Thank you for using Infragistics Components.
Hello ,
If you are using UltraExpandableGroupBox you should internally subscribe for ExpandStatChanged/ExpandStateChanging events in order to manage the size the composite control, which could cause flickering. However you could try to achieve the same using the UltraExpandableGroupBox instead of UltraGroupBox and to evaluate which exactly approach involves less efforts for you and your scenario and works better.
Thank you for using Infragisitcs Components.
Yes, I think this is the way to go in that case. Why did you use an UltraGroupBox and created the expansion logic by yourself. Wouldn't it be easier to add an UltraExpandableGroupBox to the user control?
I will try to use this approach in our project. If I encounter any issues, I will post them here. Thanks for your help!