Skip to content

Two custom control styles throw error #246

@opcodewriter

Description

@opcodewriter

I'm trying to define two custom controls in the app (not in a library), but it gives me this error:

snip_20160216131715

In Resources/Styles.fayde I have two styles defining the template for two controls.
Note that if I remove MyControl2 style, it works, no error appears

Styles.fayde:

 <Style TargetType="controls:MyControl">   
  <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:MyControl">
                    <Grid Background="Blue" />       
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

<Style TargetType="controls:MyControl2">   
  <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:MyControl2">
                    <Grid Background="Green" />       
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

The implementation is the same for both:

MyControl.ts:

import Control = Fayde.Controls.Control;
class MyControl extends Control {
    constructor() {
        super();
        this.DefaultStyleKey = MyControl;
    }
}
export = MyControl;

MyControl2.ts:

import Control = Fayde.Controls.Control;
class MyControl2 extends Control {
    constructor() {
        super();
        this.DefaultStyleKey = MyControl2;
    }
}
export = MyControl2;

In default.fap, I'm just using one control:
<controls:MyControl />

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions