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
90
How do I know when an UltraTile closed (or is hidden)
posted

I wired up to the UltraTile.VisibleChanged event and when I click on the close button for the UltraTile, it fires this event 4 count them 4 times.

 

here is my code

        void tile_VisibleChanged(object sender, System.EventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("tile_VisibleChanged : " + ((UltraTile)sender).Visible);
        }

and the output is

tile_VisibleChanged : False
tile_VisibleChanged : False
tile_VisibleChanged : True
tile_VisibleChanged : False

I would like to know when the tile is closed so that I can remove it from the collection and actually close it, not just hide it.

Parents
  • 3707
    Suggested Answer
    posted

    I racked my brain for hours trying to figure out how to achieve what you had trouble with here. It surprised me that they really didn't have a simplified way to do it already implemented.

    Here's how I did it:

        public partial class Form1 : Form, Infragistics.Win.IUIElementCreationFilter
        {
            public Form1()
            {
                InitializeComponent();

                tilePanelTest.CreationFilter = this;
            }

            #region IUIElementCreationFilter Members

            public void AfterCreateChildElements(Infragistics.Win.UIElement parent)
            {
                if (parent is TileHeaderButtonUIElement)
                {
                    TileHeaderButtonUIElement closeButtonElement = parent as TileHeaderButtonUIElement;
                    if (closeButtonElement.HeaderButtonType == TileHeaderButtonType.Close)
                    {
                        if (closeButtonElement.IsPressed)
                        {
                            //Add Handling Code Below
                            MessageBox.Show("Close pressed on: " + parent.Control.Name);
                            ((UltraTile)parent.Control).Hide();
                        }
                    }

                }
            }

            public bool BeforeCreateChildElements(Infragistics.Win.UIElement parent)
            {
                return false;
            }

            #endregion
        }

Reply Children
No Data