Dynamically Build NavigationPane

Feb 11, 2011 at 1:43 AM


I'm struggling to dynamically build the navigation pane. i.e adding more NavigationPaneItem, and then adding some more hover buttons in it, programmatically. Please can you provide a sample on how to do this in code, reason is, depending on a users profile security profile that login into my app I need to build up the NavigationPane.



Mar 4, 2011 at 12:44 PM

Hi, Prakashza

to add an item programmatically simle create the item and add it to the Items Collection of the NavigationPane:

   NavigationPaneItem item = new NavigationPaneItem();
   item.Header = "Programmatic Item";
   TextBlock t = new TextBlock();
   t.Text = "This item was added to the collection by code behind";
   item.Content = t;
   //item.Image = <your image here>;
   //item.SmallImage = <your small image here, if you have one>;

If you want it to appear in the bottm small buttons list, make sure you add the new item in a position grather than the last big item visible position. Items are placed on the bottom small list based on their position... if you have a total of 4 with the LageItems property of the NavigationPane set to 2, item from the third to last will be placed on the small button list.

If you want the item to be not visible at all, then use this:
   Stema.Controls.NavigationPane.SetIsItemExcluded(item, false);