Hi,
I have 4 UltraTilies on a UltraPanel in a Form. Based on the user selection can these tiles be rearranged from their position?
for eg, on form load the Ultratiles appear in the order of UltraTile1, UltraTile2, UltraTile3 and UltraTile4. Now if the user clicks on some button an dwants to rearrange the positions to UltraTile3, UltraTile2, UltraTile4 and UltraTile1, is this possible at runtime?
Attached is the image. Please help.
Hello Baba,
Try adding few controls to these Tiles in order for them to show up in UltraTilePanel. Also wrap this functionality inside BeginUpdate and EndUpdate to layout the tiles after adding all of them. For example, you can modify the above switch case in a way that it adds Tiles as shown below:
[Code]
// Begin an updte operation the UltraTilePanel so it doesn't layout the
// UltraTiles while multiple tiles are being added.
this.ultraTilePanel1.BeginUpdate();
// Add a few UltraTiles to the UltraTilePanel
UltraTile tile1 = new UltraTile();
tile1.Control = new Button();
this.ultraTilePanel1.Tiles.Add(tile1);
UltraTile tile2 = new UltraTile();
tile2.Control = new TextBox();
this.ultraTilePanel1.Tiles.Add(tile2);
UltraTile tile3 = new UltraTile();
tile3.Control = new Label();
this.ultraTilePanel1.Tiles.Add(tile3);
UltraTile tile4 = new UltraTile();
tile4.Control = new TextBox();
this.ultraTilePanel1.Tiles.Add(tile4);
// End the update operation so the UltraTilePanel can continute managing
// the UltraTile objects.
this.ultraTilePanel1.EndUpdate();
[/Code]
Please let me know if I may be of further assistance.
Hi Sahaja,
I gave a try, instead of a dictionary, i saved the order in a string[], below is my sample code
// clear the tiles first
ultraTilePanel1.Tiles.Clear();
//loop through each tile in the order and add accordingly.
foreach (string str in autoTestOrder) { switch (str) { case "UltraTile1": ultraTilePanel1.Tiles.Add(ultraTile1); break; case "UltraTile2": ultraTilePanel1.Tiles.Add(ultraTile2); break; case "UltraTile3": ultraTilePanel1.Tiles.Add(ultraTile3); break; case "UltraTile4": ultraTilePanel1.Tiles.Add(ultraTile4); break; }
}
I see that the ultraTilePanel1 has the Tiles added as per the above order, but the UltraTilePanel does not display any tiles
Do you see any thing wrong in the above sample code?
You can use a Dictionary<tilename, UltraTile> to save the user selection upon “Apply” button click. Then you can use this dictionary to add the tiles to the UltraTilePanel TileCollection object in the required order.
If you need any assistance in implementing this please send me a sample and I will modify it to demonstrate this.
Let me know if you have any questions.
Thank you Sahaja.
The order of rearranging the tiles is not known until runtime, in the sense, its the users choice. I have a List box which has list of Tiles names. Now the user can change the order of Tiles as per his needs.
For eaxmple.
Below ListBox has four tile names in the below order on form load which map to the Tile names in the main form.
Tile1
Tile2
Tile3
Tile4
Now the user wishes to change the order in the Listbox say using some UP/Down arrow butons as below and hits on apply button.
Now all my tiles in the main window should be rearranged accordingly.
If you know the order in which you want to rearrange the Tiles upon button click then it can be done simply by removing and inserting the tiles at the required index. For example, you can use the RemoveAt and Insert methods of the UltraTilePanel Tiles collection to implement this.
Let me know if I may be of further assistance.