#region event
//Event invokes when the Groupbarloaded
private void MyGroupBar_Loaded(object sender, RoutedEventArgs e)
{
pop1 = myGroupBar.Template.FindName("PART_Popup", myGroupBar) as Popup;
pop1.Opened += Pop1_Opened;
}
//Even which invokes when the popup opens
private void Pop1_Opened(object sender, EventArgs e)
{
Border border = myGroupBar.Template.FindName("PopupResizePart", myGroupBar) as Border;
GroupView groupview1 = VisualUtils.FindDescendant(border, typeof(GroupView)) as GroupView;
if (groupview1 != null)
{
foreach (GroupViewItem item in groupview1.Items)
{
item.Selected += Item_Selected;
}
}
}
//Event that invokes when the GroupViewItem get selected
private void Item_Selected(object sender, RoutedEventArgs e)
{
pop1 = myGroupBar.Template.FindName("PART_Popup", myGroupBar) as Popup;
GroupViewItem item = sender as GroupViewItem;
if(item.IsSelected)
{
//used to set the selected groupitem text
myGroupBar.NavigationPaneText = item.Text;
//used to close the popup
pop1.IsOpen = false;
}
}
#endregion
|
//Event that invokes when the GroupViewItem get selected
private void Item_Selected(object sender, RoutedEventArgs e)
{
pop1 = myGroupBar.Template.FindName("PART_Popup", myGroupBar) as Popup;
GroupViewItem item = sender as GroupViewItem;
if(item.IsSelected)
{
//used to set the selected groupitem text
myGroupBar.NavigationPaneText = item.Text;
}
}
|