Category / Section
                                    
                                How do I add or remove items in a GroupBar at runtime using procedural code?
                
                
                    1 min read
                
            
    
The following code snippet can be used to add items to a GroupBar.
[C#]
GroupBar myGroupBar = new GroupBar(); GroupBarItem gbi = new GroupBarItem(); TextBlock tt1 = new TextBlock(); tt1.Text = "New Item added"; gbi.Header = "Dynamic Items"; gbi.Content = tt1; myGroupBar.Items.Add(gbi);
The following code snippet can be used to remove items from a GroupBar
[C#]
myGroupBar.Items.Remove(gbi);
