dotnet / dotnet/wpf

ToggleButton doesn't use ContentTemplate in Fluent style

Open
#11,090 0 comments 1 reaction 0 assignees View on GitHub
Investigate Win 11 Theming
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

### Description

The `DefaultToggleButtonStyle` doesn't bind `ContentTemplate` to the `ContentPresenter` like `DefaultButtonStyle` does in the Fluent theme (I haven't looked at other themes).

### Reproduction Steps

Create a window in a WPF app configured to use the Fluent theme with the following code:
```xml






<Setter Property="ContentTemplate" Value="{StaticResource ReplaceTextTemplate}" />


<Setter Property="ContentTemplate" Value="{StaticResource ReplaceTextTemplate}" />




```

### Expected behavior

The content in the Button and ToggleButton should match and say "Replaced text".

### Actual behavior

The Button says "Replaced text", but the ToggleButton still says "Hello".

### Regression?

_No response_

### Known Workarounds

_No response_

### Impact

It makes configuring the ToggleButton more difficult and is inconsistent with the behavior of Button.

### Configuration

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.