Style based on MaterialDesignOutlinedTextBox can't set Padding

未關閉
#2,811 6 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
35/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
csharp
領域
design, desktop

研究方向

使用提供的 WPF .NET 6 XAML 重現此問題,並檢查 MaterialDesignOutlinedTextBox 樣式及其控制項範本。驗證透過衍生 Style 套用 Padding 與直接在 TextBox 上套用 Padding 時的行為;當 Style setter 能夠變更 Padding,同時直接設定 Padding 的行為維持不變時,即表示完成。

由索引模型根據 Issue 內容生成。

描述

bug
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

主要語言
C#
星號
16.3k
分支
3.5k
平均合併
4 小時 25 分鐘
30 天內合併 PR
4

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

MaterialDesignInXAML/MaterialDesignInXamlToolkit 的其他 Issue

查看 MaterialDesignInXAML/MaterialDesignInXamlToolkit 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。