These are chat archives for AvaloniaUI/Avalonia

Jan 2019
Jonas Jermann
Jan 01 2019 19:17 UTC
hi to 2019, question: Is there some example/documentation on how to do external resource dictionaries (for e.g. datatemplates)?
Jonas Jermann
Jan 01 2019 19:29 UTC
I read that documentation, there is no mention of any separate resource dictionaries.
At the moment I have all datatemplates defined for Window, which makes the main (window) xaml file huge. I would really like to "extract" all datatemplates into a separate file.
(that way they could also be used for other window/etc)
Just use a StyleInclude
Jonas Jermann
Jan 01 2019 20:49 UTC
In your example: What would I put into SideBar.xaml?
I have datatemplates
will this work if I put them inSideBar.xaml and load them like this?
Jonas Jermann
Jan 01 2019 21:48 UTC
there seems to be a ResourceInclude
Jonas Jermann
Jan 01 2019 22:27 UTC

I always get the following error though:

An exception of type 'Portable.Xaml.XamlObjectWriterException' occurred in Avalonia.Markup.Xaml.dll but was not handled in user code: 'Could not convert object 'DataTemplates.xaml' (of type System.String) to {}Uri: Invalid URI: The format of the URI could not be determined.'

The dictionary was loaded as follows:

                <ResourceInclude Source = "DataTemplates.xaml"/>

And the content of DataTemplates.xaml looks as follows:

<ResourceDictionary xmlns=""

    <view:StringToBitmapConverter x:Key = "StringToBitmapConverter"/>
    <view:DoubleToThicknessConverter x:Key = "DoubleToThicknessConverter"/>
    <view:StringToBrushConverter x:Key = "StringToBrushConverter"/>

    <DataTemplate DataType = "{x:Type vm:CardRepresentation}">