How to style a WPF Expander Header?

I have combined some XAML from Josh Smith and MSDN and came up with a solution. Indeed, the control (al least the header) must be retemplated.

I have combined some XAML from Josh Smith and MSDN and came up with a solution. Indeed, the control (al least the header) must be retemplated. This is a textbox A button.

Exactly what I needed. Thanks! – scottmarlowe Dec 14 '10 at 14:19 1 I found getting the expander width a real problem, and you code does this.It works in xamlpad flawlessly.

However in my code it does not and causes terrible graphical lag. Width="{Binding RelativeSource{RelativeSource Mode=FindAncestor,AncestorType={x:Type Expander}}, Path=ActualWidth}"> By adding the above it works, but lags. If I remove it, or change Path=Width, it doesn't work and the lag goes away.

– JonWillis Jun 13 at 20:11 +1 to JonWillis for XamlPad – surfen Jul 20 at 22:30.

Depends what you want to style -- you can style any part of it. If you want to change the content in the header, just place all your UI in the Expander. Header property, and it'll show in the header area.

If that does't meet your needs, you probably need to re-template the control. Take a look at the control templates shipped in WPF here.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions