Skip to content

Default style properties are not carried over when declaring a new style #371

Closed

Description

@benventive

I'm submitting a...

Bug report (I searched for similar issues and did not find one)

Current behavior

Declaring a style doesn't keep the default style properties that are not overriden

Expected behavior

Setting a style with only certain properties should keep the default style properties

Minimal reproduction of the problem with instructions

Use the following style in an Uno app:

<Style x:Key="TextBoxStyle"
           TargetType="TextBox">
	<Setter Property="BorderThickness"
                     Value="1" />
	<Setter Property="BorderBrush"
                     Value="DarkGray" />
</Style>

The TextBoxes will show up without a template.

Environment

Nuget Package:
Uno.UI

Package Version(s):
1.42.0-dev.334

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • Windows
  • Build tasks

Visual Studio:

  • 2017 (version: )
  • 2017 Preview (version: 15.9.0 Preview 6.0)
  • for Mac (version: )

Activity

  1. davidjohnoliver commented on Nov 16, 2018

    @davidjohnoliver
    Contributor

    Falls under #119

  2. benventive commented on Nov 19, 2018

    @benventive
    ContributorAuthor

    One workaround I've found is to base the style on the Uno one.
    For example, in the case of the TextBox described in this issue:

    <Style x:Key="TextBoxStyle"
           xamarin:BasedOn="{StaticResource XamlDefaultTextBox}"
           TargetType="TextBox">
      <Setter Property="BorderThickness"
              Value="1" />
      <Setter Property="BorderBrush"
              Value="DarkGray" />
    </Style>
    
  3. added
    platform/android 🤖
    platform/ios 🍎
    kind/bug
    on May 22, 2019
  4. added
    project/styling 👔
    on May 27, 2020
  5. added a commit that references this issue on Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugplatform/android 🤖platform/ios 🍎project/styling 👔

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions