JackSpratt
JackSpratt

Reputation:

Changing the background of a WPF toolbar panel

I'm trying to reproduce a Visual Studio style toolbar with the two gradient backgrounds in C# code. I can see how to do it in XAML, but how do I drill into the object to change the backgound of its 'MainPanelBorder' border in my C# code ?

Thanks

Upvotes: 1

Views: 2934

Answers (1)

Micah
Micah

Reputation: 116090

You would need to use the

myToolbar.Template.FindName("MainPanelBorder", myToolbar) as Panel 
   //Or whatever the type of the item is in the template.

Upvotes: 1

Related Questions