Skip to content

The custom control does not apply default style while it use as root element in xaml #185

Closed

Description

@Daoting

I'm submitting a...

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

Current behavior

The custom control does not apply default style while it use as root element in xaml. When I set style by key in constructor instead of DefaultStyleKey, it's correct. The code:
public SingleWin()
{
#if UWP
DefaultStyleKey = typeof(SingleWin);
#else
Style = (Style)Application.Current.Resources["SingleWin"];
#endif
}

Expected behavior

Minimal reproduction of the problem with instructions

Environment

Nuget Package: 

Package Version(s): 
Uno.UI 1.40.0-dev.372

Affected platform(s):
- [x] iOS
- [x] Android
- [x] WebAssembly
- [ ] Windows
- [ ] Build tasks

Visual Studio
- [x] 2017 (version: )
- [ ] 2017 Preview (version: )
- [ ] for Mac (version: )

Activity

  1. Daoting commented on Sep 11, 2018

    @Daoting
    ContributorAuthor

    xaml content like this:
    <dt:SingleWin
    x:Class="Dt.Sample.SamplesMain"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:dt="using:Dt.Base">
    ...
    </dt:SingleWin>

    code-behind:
    public sealed partial class SamplesMain : SingleWin
    {
    public SamplesMain()
    {
    InitializeComponent();
    }
    }

  2. jeromelaban commented on Sep 11, 2018

    @jeromelaban
    Member

    Thanks for the report! DefaultStyleKey is not supported yet. it's forcibly using this.GetType() by default for now. I'll link this issue to #119.

  3. added
    platform/android 🤖
    platform/ios 🍎
    platform/wasm 🌐
    kind/enhancement
    on Oct 17, 2019
  4. davidjohnoliver commented on Jul 2, 2020

    @davidjohnoliver
    Contributor

    Fixed by #1766

  5. added a commit that references this issue on Jan 17, 2024
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/enhancementplatform/android 🤖platform/ios 🍎platform/wasm 🌐

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions