These are chat archives for AvaloniaUI/Avalonia

9th
Apr 2017
Eli Arbel
@aelij
Apr 09 2017 15:45

Hi guys. I need a bit of a help. I'm trying to port AvalonEdit. I created a library (netstandard1.1) that has some controls in it. It also contains a XAML file (as an embedded resource) with the default styles. And I added that XAML using a StyleInclude into the App.xaml (using the ControlCatalog sample for now), and added an instance of a control to one of the pages:

<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:AvalonEdit="https://github.com/avaloniaui/avalonedit">
         <AvalonEdit:TextEditor Height="500" />
</UserControl>

I'm getting an exception:

{OmniXaml.ParseException: The type "{:AvalonEdit} cannot be found"
   at OmniXaml.Typing.TypeRepository.GetByPrefix(String prefix, String typeName) in Markup\Avalonia.Markup.Xaml\OmniXAML\Source\OmniXaml\Typing\TypeRepository.cs:line 61
   at OmniXaml.RuntimeTypeSource.GetByPrefix(String prefix, String typeName) in Markup\Avalonia.Markup.Xaml\OmniXAML\Source\OmniXaml\RuntimeTypeSource.cs:line 54
   at Avalonia.Markup.Xaml.Context.AvaloniaRuntimeTypeSource.GetByPrefix(String prefix, String typeName) in Markup\Avalonia.Markup.Xaml\Context\AvaloniaRuntimeTypeSource.cs:line 73
   at Avalonia.Markup.Xaml.Converters.SelectorTypeConverter.<>c__DisplayClass2_0.<ConvertFrom>b__0(String t, String ns) in Markup\Avalonia.Markup.Xaml\Converters\SelectorTypeConverter.cs:line 25
   at Avalonia.Markup.Xaml.Parsers.SelectorParser.Parse(String s) in Markup\Avalonia.Markup.Xaml\Parsers\SelectorParser.cs:line 55
   at Avalonia.Markup.Xaml.Converters.SelectorTypeConverter.ConvertFrom(IValueContext context, CultureInfo culture, Object value) in Markup\Avalonia.Markup.Xaml\Converters\SelectorTypeConverter.cs:line 26
   at OmniXaml.Typing.CommonValueConversion.ConverterStep.TryConvert(Object value, XamlType targetType, IValueContext valueContext, Object& result) in Markup\Avalonia.Markup.Xaml\OmniXAML\Source\OmniXaml\Typing\CommonValueConversion.cs:line 132
   at OmniXaml.Typing.CommonValueConversion.TryConvert(Object value, XamlType targetType, IValueContext valueContext, Object& result) in Markup\Avalonia.Markup.Xaml\OmniXAML\Source\OmniXaml\Typing\CommonValueConversion.cs:line 27
   at OmniXaml.ObjectAssembler.StateCommuter.AssignChildToParentProperty() in Markup\Avalonia.Markup.Xaml\OmniXAML\Source\OmniXaml\ObjectAssembler\StateCommuter.cs:line 73
   at OmniXaml.ObjectAssembler.StateCommuter.AssociateCurrentInstanceToParent() in Markup\Avalonia.Markup.Xaml\OmniXAML\Source\OmniXaml\ObjectAssembler\StateCommuter.cs:line 172
   at OmniXaml.ObjectAssembler.Commands.ValueCommand.Execute() in Markup\Avalonia.Markup.Xaml\OmniXAML\Source\OmniXaml\ObjectAssembler\Commands\ValueCommand.cs:line 40
   at OmniXaml.ObjectAssembler.ObjectAssembler.Process(Instruction instruction) in Markup\Avalonia.Markup.Xaml\OmniXAML\Source\OmniXaml\ObjectAssembler\ObjectAssembler.cs:line 82
   at OmniXaml.TemplateHostingObjectAssembler.Process(Instruction instruction) in Markup\Avalonia.Markup.Xaml\OmniXAML\Source\OmniXaml\TemplateHostingObjectAssembler.cs:line 75
   at Avalonia.Markup.Xaml.Context.AvaloniaObjectAssembler.Process(Instruction node) in Markup\Avalonia.Markup.Xaml\Context\AvaloniaObjectAssembler.cs:line 55
   at OmniXaml.XmlParser.Parse(IEnumerable`1 xamlNodes) in Markup\Avalonia.Markup.Xaml\OmniXAML\Source\OmniXaml\XmlParser.cs:line 32
   at OmniXaml.XmlParser.Parse(IXmlReader stream) in Markup\Avalonia.Markup.Xaml\OmniXAML\Source\OmniXaml\XmlParser.cs:line 27
   at OmniXaml.XmlLoader.Load(Stream stream, IParser parser) in Markup\Avalonia.Markup.Xaml\OmniXAML\Source\OmniXaml\XmlLoader.cs:line 29}
How does Avalonia find the URI https://github.com/avaloniaui/avalonedit (I added XmlnsDefinition attributes)? There's no XAML compilation step from what I can tell. So does it load all the assemblies in the directory and search for attributes?
Eli Arbel
@aelij
Apr 09 2017 15:57
I tried using clr-namespace:ICSharpCode.AvalonEdit;assembly=Avalonia.AvalonEdit but I'm still getting the same error
I thinks this was working
Eli Arbel
@aelij
Apr 09 2017 15:59
From what I can tell it's trying to load the XAML file from the StyleInclude and getting errors inside that file. Is it okay to write
 <Style Selector="AvalonEdit:TextEditor">
Eli Arbel
@aelij
Apr 09 2017 16:16
Oh, the ns separator is |, so it should be <Style Selector="AvalonEdit|TextEditor">. Is there a doc with all the selector syntax?
danwalmsley
@danwalmsley
Apr 09 2017 18:51
@aelij I tried porting a while back, but failed, at the level where it comes to document model and text runs
I managed to build an editor based on Avalon editor
That is currently compatible with monospaced fonts
you can see my efforts here:
If you manage to make progress where I didn't will be amazing! Desperate for Avalon edit control!
Good luck!
Eli Arbel
@aelij
Apr 09 2017 21:00
Thanks, @danwalmsley. I got the whole thing to compile. Now it's a matter of getting it to actually work ;)
AvalonStudio looks promising. .So what's missing from it? I don't really mind the monospace limitation
My end goal is to create an xplat version of this: https://github.com/aelij/RoslynPad
danwalmsley
@danwalmsley
Apr 09 2017 21:19
@aelij nice, come join in the Avalon studio room :)