MaterialDesignInXAML / MaterialDesignInXAML/MaterialDesignInXamlToolkit

Style based on MaterialDesignOutlinedTextBox can't set Padding

Open
#2,811 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
16.3k
Forks
3.5k
Avg merge
1d 22h
Merged PRs (30d)
8

Description

Bug explanation

I want to use a Style for TextBox based on MaterialDesignOutlinedTextBox and set the Padding.
This doesnt work.

What I did:

  • create a TextBox Style (implicit or with a x:Key) based on MaterialDesignOutlinedTextBox
  • have a Setter for Padding
  • create a TextBox deriving from it
<!--in the Resources -->
<Style x:Key="SampleStyle" TargetType="{x:Type TextBox}" BasedOn="{StaticResource MaterialDesignOutlinedTextBox}">
     <Setter Property="Padding" Value="5"></Setter>
</Style>


<!--in Body of the UserControl / Page / Window-->
<TextBox Style="{StaticResource SampleStyle}" Text="Sample"/>


Result:
No Padding changes

Expected:
Padding changes

When I change the Padding at the TextBox directly


<TextBox Padding="5" Style="{StaticResource SampleStyle}" Text="Sample"/>

The Padding changes

The Project is in WPF with .net6.0-windows

Version

4.5.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the provided WPF .NET 6 XAML and inspect the MaterialDesignOutlinedTextBox style and its control template. Verify how Padding is applied through a derived Style versus directly on the TextBox; done means the Style setter changes Padding while direct Padding behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
design, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.