Replies: 2 comments 3 replies
-
You should be able to apply the style in your application styles. However it may not work depending on which style is more specific, I am not sure what Avalonia's precedence rules are in this case. If it does not work, a bruteforce work around is to just override the template with a custom one. |
Beta Was this translation helpful? Give feedback.
-
Which theme are you using? Fluent, Simple or a 3rd party? You are referring to a One of the biggest issues in Avalonia styling is precedence with style selectors. These cannot override values set in control templates which have higher local priority (effectively making them useless in a lot of cases). Work arounds are to go deeper into the template and select on content presenter, etc. directly. See #7679 (reverted) and #13601. However, in this case I don't think that's the issue. I looked at both Fluent and Simple theme (you have to tell us the theme you are using) and see that MinHeight on the border in set by a TemplateBinding so it is overridable just fine. Long story short, for in-box Avalonia themes you should simply be using: <Style Selector="TextBox">
<Setter
Property="MinHeight"
Value="0" />
</Style> |
Beta Was this translation helpful? Give feedback.
-
I want to minimize the size of a
TextBox
when used with a small font size. I noticed that aBorder#PART_ContentPresenterBorder
within the visual tree of the TextBox has aMinHeight
set. I want to set this to 0 for everyTextBox
.I came along with the following style. But this has the disadvantage that every
TextBox
needs to get theClass
Small
assigned to it to apply the style. Is there a way to apply this styling to everyTextBox
without setting theClass
?Beta Was this translation helpful? Give feedback.
All reactions