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
1075
UltraTrackBar in UltraExpandableGroupBox header
posted

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
  }
}
Parents Reply Children