Materialdesigninxamltoolkit: Expander Header: StringFormat not formatting string

Created on 31 May 2017  Â·  2Comments  Â·  Source: MaterialDesignInXAML/MaterialDesignInXamlToolkit

I'm binding a normal string to the Header of an Expander and trying to format the string using StringFormat. The binding works, but is not being formatted. It's not that it's being formatted incorrectly, it's not being formatted at all.

question

All 2 comments

Hi, that is not a problem with MaterialDesignInXaml.

That happens because of the structure of Header in WPF. It is not a string.
See:

https://msdn.microsoft.com/en-us/library/system.windows.controls.headeredcontentcontrol.header(v=vs.110).aspx

To accomplish what you need, I suggest you something like:

HorizontalAlignment="Left" Background="LavenderBlush"
ExpandDirection="Down" IsExpanded="False" Width="250"
FontSize="20" FontWeight="Bold" Foreground="Green" >

  </Expander.Header>

<TextBlock TextWrapping="Wrap" FontSize="14" FontWeight="Light"

Foreground="Black">

       This is an Expander control. Within this control, all

contents will be wrapped.

       At run-time, you may expand or collapse this control. Type

more text here to be typed.
Jump around and hype.

2017-05-31 11:55 GMT-03:00 MysticAppDevelopment notifications@github.com:

I'm binding a normal string to the Header of an Expander and trying to
format the string using StringFormat. The binding works, but is not being
formatted. It's not that it's being formatted incorrectly, it's not being
formatted at all.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/ButchersBoy/MaterialDesignInXamlToolkit/issues/722,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AH_-j7WX4rT_-lSSkfArCowaMoqM-dowks5r_X9GgaJpZM4NrwJJ
.

@MysticAppDevelopment Are you sure HeaderStringFormat is not what you want?

Was this page helpful?
0 / 5 - 0 ratings