liusujin
Topic Author
Posts: 3
Joined: 02 Jan 2019, 04:10

NoesisException: Can't assign property to abstract class 'CornerRadius'.

07 Jan 2019, 16:56

There is something wrong when i imports the xaml file in unity editor.The Error info is as shown below:

NoesisException: Assets/NoesisGUI/Samples/Test/UIStyle.xaml(4): Can't assign property to abstract class 'CornerRadius'.
Rethrow as NoesisException
Noesis.Error.Check () (at Assets/NoesisGUI/Plugins/API/Core/NoesisError.cs:17)
Noesis.GUI.Noesis_LoadXaml_ (System.String xaml) (at Assets/NoesisGUI/Plugins/API/Core/NoesisGUI.cs:275)
Noesis.GUI.LoadXaml (System.String xaml) (at Assets/NoesisGUI/Plugins/API/Core/NoesisGUI.cs:125)
NoesisXaml.Load () (at Assets/NoesisGUI/Plugins/NoesisXaml.cs:31)
NoesisPostprocessor+<>c__DisplayClass16_0.<ImportXaml>b__0 () (at Assets/NoesisGUI/Plugins/Editor/NoesisPostprocessor.cs:353)
UnityEngine.Debug:LogException(Exception, Object)
<>c__DisplayClass16_0:<ImportXaml>b__0() (at Assets/NoesisGUI/Plugins/Editor/NoesisPostprocessor.cs:359)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

I am not sure if the code
CornerRadius="{StaticResource RoundedCorner}"
cause this?
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:Utils.Model.UIControl">
    
    <CornerRadius x:Key="RoundedCorner" TopLeft="5.0" TopRight="5.0" BottomRight="5.0" BottomLeft="5.0"/>
    
    <SolidColorBrush x:Key="ButtonBackground_Normal" Color="Black"/>
    <SolidColorBrush x:Key="ButtonBackground_Hover" Color="Red"/>
    <SolidColorBrush x:Key="ButtonBackground_Disable" Color="Gray"/>

    <Style TargetType="{x:Type Button}" x:Key="Default">        
        <Setter Property="Background" Value="{StaticResource ButtonBackground_Normal}"/>
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="FontSize" Value="24"/>
        <Setter Property="Width" Value="200"/>
        <Setter Property="Height" Value="45"/>        
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Border Background="{TemplateBinding Background}"
                            CornerRadius="{StaticResource RoundedCorner}">
                        <ContentPresenter HorizontalAlignment="Center"
                                          VerticalAlignment="Center"
                                          Content="{TemplateBinding Content}">
                        </ContentPresenter>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background" Value="{StaticResource ButtonBackground_Hover}"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="False">
                            <Setter Property="Background" Value="{StaticResource ButtonBackground_Normal}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Background" Value="{StaticResource ButtonBackground_Disable}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
<UserControl x:Class="Utils.Model.UIControl.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Utils.Model.UIControl"
        mc:Ignorable="d"
        d:DesignHeight="1080" d:DesignWidth="1920">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="UIStyle.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Button Content="Button" Style="{StaticResource Default}"></Button>
    </Grid>
</UserControl>
 
User avatar
sfernandez
Site Admin
Posts: 2984
Joined: 22 Dec 2011, 19:20

Re: NoesisException: Can't assign property to abstract class 'CornerRadius'.

08 Jan 2019, 02:16

I was able to reproduce this issue, could you please report it in our bugtracker?.

In the meantime It should work by using the string conversion:
<CornerRadius x:Key="cr">5,10,15,20</CornerRadius>
 
liusujin
Topic Author
Posts: 3
Joined: 02 Jan 2019, 04:10

Re: NoesisException: Can't assign property to abstract class 'CornerRadius'.

08 Jan 2019, 02:31

I was able to reproduce this issue, could you please report it in our bugtracker?.

In the meantime It should work by using the string conversion:
<CornerRadius x:Key="cr">5,10,15,20</CornerRadius>
thx! It works perfect.But there is something wrong about my account or pwd when i try to enter bugtracker,it confuses me very much.
 
User avatar
jsantos
Site Admin
Posts: 3906
Joined: 20 Jan 2012, 17:18
Contact:

Re: NoesisException: Can't assign property to abstract class 'CornerRadius'.

08 Jan 2019, 04:01

thx! It works perfect.But there is something wrong about my account or pwd when i try to enter bugtracker,it confuses me very much.
You need to create a new account in the tracker. Sorry for the inconvenience.
 
liusujin
Topic Author
Posts: 3
Joined: 02 Jan 2019, 04:10

Re: NoesisException: Can't assign property to abstract class 'CornerRadius'.

08 Jan 2019, 04:04

thx! It works perfect.But there is something wrong about my account or pwd when i try to enter bugtracker,it confuses me very much.
You need to create a new account in the tracker. Sorry for the inconvenience.
ok, i'll do it later.thx again!
 

Who is online

Users browsing this forum: No registered users and 103 guests