NoesisException: Can't assign property to abstract class 'CornerRadius'.
Posted: 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 cause this?
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
Code: Select all
CornerRadius="{StaticResource RoundedCorner}"
Code: Select all
<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>
Code: Select all
<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>