How Load Dockpanel from resource dictionary in c#
Question
I want to load a dockpanel control to an wpf window. the dockpanel control is on a resource dictionary file and that is merged in the window I want to use it. I want the c# code that can add this dock panel to a existing dockpanelhost control on the window dynamically upon a button click event. Please help me by providing the c# code implementation
Regards
Solution
You can get your DockPanel from resources like that:
var dockPanel = FindResource("DockPanelKey") as DockPanel;
Later add this line to insert dockPanel to for example grid:
m_Grid.Children.Add(dockPanel);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow