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 : Falsetile_VisibleChanged : Falsetile_VisibleChanged : Truetile_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.
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 }
tbetts1982,
I have used your proposed filter and it works good!
Thank you !
Gianni