These are chat archives for AvaloniaUI/Avalonia

22nd
Jan 2019
Steven Hall
@vaindil
Jan 22 00:53
image.png
This is written in Java and I'm seeing if I can port it to .NET Core. This tiny thing is a window that's updated dynamically. I can do the logic, but is it possible to at least come close to this look? Are transparent windows still not supported?
Kermalis
@Kermalis
Jan 22 01:40
Gotta tell you guys, I've been impressed with Avalonia since the start, but now that I'm trying Xamarin for the first time I'm even more impressed with Avalonia lol
Steven Hall
@vaindil
Jan 22 01:57
Never mind with my question, this is just way too complex to implement a tiny window like that. Thanks!
SunTai(三台)
@a44281071
Jan 22 01:59
xamarin is good. avalonia just a child.
M. Gage Morgan
@MGageMorgan
Jan 22 04:43
Hey, so I'm new to Avalonia, and it's not recognizing the Source attribute for the <Image> XAML tag. Is this a known issue? If so, is there a way to do it in C#?
Nikita Tsukanov
@kekekeks
Jan 22 05:22
not recognizing?
that version needs assets to be packaged via AvaloniaResource and requires a version from nightly builds
This version looks for EmbeddedResource entries
M. Gage Morgan
@MGageMorgan
Jan 22 05:28
Okay, so how do I go about doing either of those? I'm a complete noob - I have a working WPF app that I made and I'm trying to convert it over to Avalonia. Which is easier - EmbeddedResource or AvaloniaResource?
I should also mention that in the context of WPF I'm completely new to C# - I've done message boxes and click events in vanilla WPF, but that's about it. I did a more complex CLI app in Mono ages ago, but it's been a minute.
Jeremy Koritzinsky
@jkoritzinsky
Jan 22 05:31
@MGageMorgan if you're using the NuGet release version, only EmbeddedResource is available. Otherwise, you should use AvaloniaResource whenever possible. It'll act more like you'd expect.
M. Gage Morgan
@MGageMorgan
Jan 22 05:34
@jkoritzinsky If I switch to Nightly, how do I use AvaloniaResource to load images? Is there a clear-cut example?
Nikita Tsukanov
@kekekeks
Jan 22 05:35
I think we need a migration manual...
2) You need your XAML files to have a correct x:Class
That allows you to use relative paths
M. Gage Morgan
@MGageMorgan
Jan 22 05:41
Okay, so my current Avalonia project doesnt have a csproj file. Do I create it?
M. Gage Morgan
@MGageMorgan
Jan 22 05:54
Figured out csproj situation. Hidden in Solution Explorer.
M. Gage Morgan
@MGageMorgan
Jan 22 06:02
I'm hitting a wall here
<EmbeddedResource Include="Images\*" /> has been added to my .csproj file.
I added <Image Source="Images/indiana.png" MouseDown="Indiana_Click" /> to the xaml file for my project
Then this happened:
M. Gage Morgan
@MGageMorgan
Jan 22 06:09
Portable.Xaml.XamlObjectWriterException: Could not convert object 'Indiana.png' (of type System.String) to {clr-namespace:Avalonia.Media.Imaging;assembly=Avalonia.Visuals}IBitmap: HRESULT: [0x80070002], Module: [Unknown], ApiCode: [Unknown/Unknown], Message: The system cannot find the file specified.
 ---> SharpDX.SharpDXException: HRESULT: [0x80070002], Module: [Unknown], ApiCode: [Unknown/Unknown], Message: The system cannot find the file specified.

   at SharpDX.Result.CheckError()
   at SharpDX.WIC.ImagingFactory.CreateDecoderFromFilename(String filename, Nullable`1 guidVendorRef, Int32 desiredAccess, DecodeOptions metadataOptions, BitmapDecoder decoderOut)
   at Avalonia.Direct2D1.Media.WicBitmapImpl..ctor(ImagingFactory factory, String fileName)
   at Avalonia.Direct2D1.Direct2D1Platform.LoadBitmap(String fileName)
   at Avalonia.Media.Imaging.Bitmap..ctor(String fileName)
   at Avalonia.Markup.Xaml.Converters.BitmapTypeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
   at Portable.Xaml.XamlObjectWriterInternal.GetCorrectlyTypedValue(XamlMember xm, XamlType xt, Object value)
   --- End of inner exception stack trace ---
   at Portable.Xaml.XamlObjectWriterInternal.GetCorrectlyTypedValue(XamlMember xm, XamlType xt, Object value)
   at Portable.Xaml.XamlObjectWriterInternal.StoreAppropriatelyTypedValue(ObjectState state, MemberAndValue ms, Object obj, Object keyObj)
   at Portable.Xaml.XamlObjectWriterInternal.OnWriteValue(Object value)
   at Portable.Xaml.XamlObjectWriter.WriteValue(Object value)
   at Portable.Xaml.XamlWriter.WriteNode(XamlReader reader)
   at Portable.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.LoadFromReader(XamlReader reader, AvaloniaXamlContext context)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.Load(Stream stream, Object rootInstance, Uri uri)
   at Avalonia.DesignerSupport.DesignWindowLoader.LoadDesignerWindow(String xaml, String assemblyPath)
   at Avalonia.DesignerSupport.Remote.RemoteDesignerEntryPoint.<>c__DisplayClass17_0.<OnTransportMessage>b__0()
Nikita Tsukanov
@kekekeks
Jan 22 06:19
it seems that you are using an outdated version
It also seems that we haven't updated VS extension to support relative paths (/-rooted paths should work)
M. Gage Morgan
@MGageMorgan
Jan 22 06:21
How do I get the latest? According to NuGet I'm on 0.7.1-build989-beta. Is there a way to go further?
@kekekeks What is the best way to get Visual Studio to work with me on this?
it shouldn't try to call the filename ctor
Try using /-rooted paths
like here
M. Gage Morgan
@MGageMorgan
Jan 22 06:35
It won't work with /-rooted paths. Just direct links to files starting with C:...which won't work if I try to take it over to something like linux
Adding a / like /Images/indiana.png spits out the same error as above
ahopper
@ahopper
Jan 22 06:36
newer NuGets are near the bottom of the list due to a sorting issue
M. Gage Morgan
@MGageMorgan
Jan 22 06:41
Just installed it. IntelliSense isn't picking up AvaloniaResource in csproj file still
M. Gage Morgan
@MGageMorgan
Jan 22 06:47
Fixed - csproj file doesn't always update, but fixed build number to 1156 and it works
M. Gage Morgan
@MGageMorgan
Jan 22 07:03
I cannot get this thing to work for the life of me. I got it to accept relative paths in the visual editor, but when I go to build it it spits out ```
Portable.Xaml.XamlObjectWriterException
  HResult=0x80131500
  Message=Could not convert object '/Images/indiana.png' (of type System.String) to {clr-namespace:Avalonia.Media.Imaging;assembly=Avalonia.Visuals}IBitmap: Relative uris for 'resm' scheme aren't supported; resm:StatesAndCapitalsAvalonia.MainWindow.xaml?assembly=StatesAndCapitalsAvalonia uses resm
  Source=Avalonia.Markup.Xaml
  StackTrace:
   at Portable.Xaml.XamlObjectWriterInternal.GetCorrectlyTypedValue(XamlMember xm, XamlType xt, Object value)
   at Portable.Xaml.XamlObjectWriterInternal.StoreAppropriatelyTypedValue(ObjectState state, MemberAndValue ms, Object obj, Object keyObj)
   at Portable.Xaml.XamlObjectWriterInternal.OnWriteValue(Object value)
   at Portable.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoader.LoadFromReader(XamlReader reader, AvaloniaXamlContext context, IAmbientProvider parentAmbientProvider)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(Stream stream, Assembly localAssembly, Object rootInstance, Uri uri)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(Type type, Object rootInstance)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(Object obj)
   at StatesAndCapitalsAvalonia.MainWindow.InitializeComponent() in C:\Users\gagem\Documents\GitHub\WPFProjects\StatesAndCapitalsAvalonia\StatesAndCapitalsAvalonia\MainWindow.xaml.cs:line 19
   at StatesAndCapitalsAvalonia.MainWindow..ctor() in C:\Users\gagem\Documents\GitHub\WPFProjects\StatesAndCapitalsAvalonia\StatesAndCapitalsAvalonia\MainWindow.xaml.cs:line 11

Inner Exception 1:
ArgumentException: Relative uris for 'resm' scheme aren't supported; resm:StatesAndCapitalsAvalonia.MainWindow.xaml?assembly=StatesAndCapitalsAvalonia uses resm
Nikita Tsukanov
@kekekeks
Jan 22 07:31
You need your xaml to be included as AvaloniaResource and have proper x:Class
Otherwise new resource uris won't work
It's really confusing, but we have old resm: handling for compatibility
Steven Hall
@vaindil
Jan 22 14:43
I installed the VS extension, but the designer doesn't work. It's saying "MyNamespace.Program doesn't have a method named BuildAvaloniaApp", except it definitely does have that method
I've also lost all XAML intellisense, whereas it was working without the extension installed
ahopper
@ahopper
Jan 22 14:47
there is a link here AvaloniaUI/AvaloniaVS#76 to a version that works for me
you have to build your project before it works
Nikita Tsukanov
@kekekeks
Jan 22 15:06

MyNamespace.Program doesn't have a method named BuildAvaloniaApp

Literally the first google result - AvaloniaUI/Avalonia#1242

BTW, we should implement the "msbuild task" part there
Would help with AOT by a lot
VS extension needs a rework though
Steven Hall
@vaindil
Jan 22 15:10
That wasn't the problem though, it was the extension itself. That issue was from the end of 2017, and my function was exactly the same as in the templates. Thanks though.
@ahopper that fixed it, thanks!
Steven Hall
@vaindil
Jan 22 15:37
Now I'm getting this, what am I missing? "Could not CreateWindow(): IWindowingPlatform is not registered."
Nikita Tsukanov
@kekekeks
Jan 22 15:39
You are missing
static void Main(string[] args) => BuildAvaloniaApp().Start<MainWindow>();

static AppBuilder BuildAvaloniaApp()
   => AppBuilder
        .UsePlatformDetect()
        .UseReactiveUI();
Steven Hall
@vaindil
Jan 22 15:40
I have that, except I'm declaring my own MainWindow and trying to start that
Nikita Tsukanov
@kekekeks
Jan 22 15:40
You can't use any of our APIs before initializing
Steven Hall
@vaindil
Jan 22 15:40
I understand, I'm not trying to
Oh wait
Never mind, I see
You can do it like this
And create your window instance in AppMain
Steven Hall
@vaindil
Jan 22 15:47
I need to be able to access the MainWindow class later on, which is why I'm trying to instantiate it separately
That's what causes this error
Steven Hall
@vaindil
Jan 22 15:53
All I'm trying to do is create a tiny window somewhat similar to this one that dynamically updates, and it's proven to be so difficult
image.png
Nikita Tsukanov
@kekekeks
Jan 22 16:12
I'm afraid we don't support transparency on Win32/OSX yet
Also we won't support transparency on Win7 with aero disabled
danwalmsley
@danwalmsley
Jan 22 16:15
Wouldnt a popup work for that?
!
Benedikt Schroeder
@Gillibald
Jan 22 16:25
I would create a with WS_EX_LAYERED and without any decorations and then just use https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setlayeredwindowattributes with some colorkey.
That still doesn't work without aero and needs some extra refreshing code.
Nikita Tsukanov
@kekekeks
Jan 22 16:28
setting a constant alpha would work
James Burnside
@JCBurnside
Jan 22 17:07
just sanity check top left of the canvas is 0,0 correct?
Steven Hall
@vaindil
Jan 22 17:30
Ignoring getting it to look nice, I'm not sure how to actually run this. I essentially have a service running, and I just need to update the display every so often based on the service. Do I have the run the entire thing in the context of the UI?
I don't really know how to word it
app.Start() blocks, which breaks the service
M. Gage Morgan
@MGageMorgan
Jan 22 17:58
@kekekeks Could you elaborate on what you meant when you said "You need your XAML files to have a correct x:Class"?
I changed everything, including XAML files in .csproj file to use AvaloniaResource. I changed the x:Class in the main XAML file to be the name of the project with .MainWindow at the end.
That doesn't stop it from doing this:
System.IO.FileNotFoundException
  HResult=0x80070002
  Message=Unable to find view for StatesAndCapitalsAvalonia.App
  Source=Avalonia.Markup.Xaml
  StackTrace:
   at Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(Type type, Object rootInstance)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(Object obj)
   at StatesAndCapitalsAvalonia.App.Initialize() in C:\Users\gagem\Documents\GitHub\WPFProjects\StatesAndCapitalsAvalonia\StatesAndCapitalsAvalonia\App.xaml.cs:line 10
   at Avalonia.Controls.AppBuilderBase`1.Setup()
   at Avalonia.Controls.AppBuilderBase`1.Start[TMainWindow](Func`1 dataContextProvider)
   at StatesAndCapitalsAvalonia.Program.Main(String[] args) in C:\Users\gagem\Documents\GitHub\WPFProjects\StatesAndCapitalsAvalonia\StatesAndCapitalsAvalonia\Program.cs:line 11
M. Gage Morgan
@MGageMorgan
Jan 22 18:03
Line 10 of the file mentioned: AvaloniaXamlLoader.Load(this);
Nikita Tsukanov
@kekekeks
Jan 22 18:07
Xaml file has to be included via AvaloniaResource and have the x:Class set to the corresponding codebehind file
M. Gage Morgan
@MGageMorgan
Jan 22 18:15
Okay, so included in .csproj:
    <AvaloniaResource Include="**\*.xaml">
      <SubType>Designer</SubType>
    </AvaloniaResource>
Now, in App.xaml:
<Application xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             x:Class="StatesAndCapitalsAvalonia.App">
    <Application.Styles>
        <StyleInclude Source="resm:Avalonia.Themes.Default.DefaultTheme.xaml?assembly=Avalonia.Themes.Default"/>
        <StyleInclude Source="resm:Avalonia.Themes.Default.Accents.BaseLight.xaml?assembly=Avalonia.Themes.Default"/>
    </Application.Styles>
</Application>
This is the error:
System.Reflection.TargetInvocationException
  HResult=0x80131604
  Message=Exception has been thrown by the target of an invocation.
  Source=System.Private.CoreLib
  StackTrace:
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance[T]()
   at Avalonia.Controls.AppBuilderBase`1.Start[TMainWindow](Func`1 dataContextProvider)
   at StatesAndCapitalsAvalonia.Program.Main(String[] args) in C:\Users\gagem\Documents\GitHub\WPFProjects\StatesAndCapitalsAvalonia\StatesAndCapitalsAvalonia\Program.cs:line 11

Inner Exception 1:
FileNotFoundException: Unable to find view for StatesAndCapitalsAvalonia.MainWindow
Okay, so I just set MainWindow.xaml to:
<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        x:Class="StatesAndCapitalsAvalonia.MainWindow">
        Title="MainWindow" Background="#FFB0EDEE"  Width="884.666" Height="586.282">
And it gives a different error this time,
Portable.Xaml.XamlDuplicateMemberException
  HResult=0x80131500
  Message=Property '{clr-namespace:Avalonia.Controls;assembly=Avalonia.Controls}ContentControl.Content' is already set to this '{clr-namespace:Avalonia.Controls;assembly=Avalonia.Controls}Window' object
  Source=Avalonia.Markup.Xaml
  StackTrace:
   at Portable.Xaml.XamlWriterInternalBase.WriteStartMember(XamlMember property)
   at Portable.Xaml.XamlObjectWriter.WriteStartMember(XamlMember property)
   at Avalonia.Markup.Xaml.PortableXaml.AvaloniaXamlObjectWriter.WriteStartMember(XamlMember property)
   at Portable.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoader.LoadFromReader(XamlReader reader, AvaloniaXamlContext context, IAmbientProvider parentAmbientProvider)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(Stream stream, Assembly localAssembly, Object rootInstance, Uri uri)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(Type type, Object rootInstance)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(Object obj)
   at StatesAndCapitalsAvalonia.MainWindow.InitializeComponent() in C:\Users\gagem\Documents\GitHub\WPFProjects\StatesAndCapitalsAvalonia\StatesAndCapitalsAvalonia\MainWindow.xaml.cs:line 19
   at StatesAndCapitalsAvalonia.MainWindow..ctor() in C:\Users\gagem\Documents\GitHub\WPFProjects\StatesAndCapitalsAvalonia\StatesAndCapitalsAvalonia\MainWindow.xaml.cs:line 11
Steven Kirk
@grokys
Jan 22 18:29
@MGageMorgan can you post the rest of your MainWindow.xaml?
M. Gage Morgan
@MGageMorgan
Jan 22 18:30
<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        x:Class="StatesAndCapitalsAvalonia.MainWindow">
        Title="MainWindow" Background="#FFB0EDEE"  Width="884.666" Height="586.282">

  <Grid>
    <Grid.RowDefinitions>
      <RowDefinition Height="20" />
      <RowDefinition Height="auto" />
      <RowDefinition Height="auto" />
      <RowDefinition Height="auto" />
      <RowDefinition Height="auto" />
      <RowDefinition Height="auto" />
      <RowDefinition Height="20" />
    </Grid.RowDefinitions>

    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="20" />
      <ColumnDefinition Width="158" />
      <ColumnDefinition Width="*" />
      <ColumnDefinition Width="auto" />
      <ColumnDefinition Width="20" />
    </Grid.ColumnDefinitions>

    <Border Margin="3 3 3 3" BorderThickness="1" BorderBrush="#FF000000" Grid.Column="1" Grid.Row="1">
      <!--
      <ContentControl Content="Indiana should be here"/>
      -->
      <Image Source="/Images/indiana.png" />
    </Border>

    <Border Margin="3 3 3 3" BorderThickness="1" BorderBrush="#FF000000" Grid.Column="1" Grid.Row="2">
      <Image Source="/Images/iowa.png" />
    </Border>

    <Border Margin="3 3 3 3" BorderThickness="1" BorderBrush="#FF000000" Grid.Column="1" Grid.Row="3">
      <Image Source="/Images/kentucky.png" />
    </Border>

    <Border Margin="3 3 3 3" BorderThickness="1" BorderBrush="#FF000000" Grid.Column="1" Grid.Row="4">
      <Image Source="/Images/montana.png" />
    </Border>

    <Border Margin="3 3 3 3" BorderThickness="1" BorderBrush="#FF000000" Grid.Column="1" Grid.Row="5">
      <Image Source="/Images/vermont.png" />
    </Border>

    <Grid Grid.Column="3" Grid.Row="1" Grid.RowSpan="2">
      <Grid.RowDefinitions>
        <RowDefinition Height="auto" />
        <RowDefinition Height="auto" />
        <RowDefinition Height="auto" />
        <RowDefinition Height="auto" />
      </Grid.RowDefinitions>

      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="auto" />
      </Grid.ColumnDefinitions>
      <Button Content="Trivia" Margin="0 0 0 21" Grid.Row="1" Background="DarkSalmon" Width="75" />
      <Button Content="Trivia" Margin="0 0 0 21" Grid.Row="2" Background="DarkSalmon" Width="75" />
      <Button Content="Trivia" Grid.Row="3" Background="DarkSalmon" Width="75" />
    </Grid>

    <Grid Grid.Column="3" Grid.Row="5" Grid.RowSpan="1">
      <Grid.RowDefinitions>
        <RowDefinition Height="auto" />
        <RowDefinition Height="auto" />
        <RowDefinition Height="auto" />
        <RowDefinition Height="auto" />
      </Grid.RowDefinitions>

      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="auto" />
      </Grid.ColumnDefinitions>
      <Button Content="Trivia" Margin="0 0 0 21" Grid.Row="0" Background="DarkSalmon" Width="75" />
      <Button Content="Trivia" Margin="0 0 0 21" Grid.Row="2" Background="DarkSalmon" Width="75" />
      <Button Content="Trivia" Grid.Row="3" Background="DarkSalmon" Width="75" />
    </Grid>

    <ContentControl x:Name="InstructionLabel" Content="Reset the damn thing using C# text property" Grid.Column="2" Grid.Row="1" FontSize="19.25" FontFamily="SegoeUI-Light"/>

    <Grid Grid.Column="2" Grid.Row="5" Grid.RowSpan="1">
      <Grid.RowDefinitions>
        <RowDefinition Height="*" />
        <RowDefinition Height="auto" />
        <RowDefinition Height="auto" />
        <RowDefinition Height="auto" />
      </Grid.RowDefinitions>

      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="auto" />
        <ColumnDefinition Width="*" />
      </Grid.ColumnDefinitions>

      <Button Content="Exit" Grid.Row="3" Grid.Column="1" Background="DarkSalmon" Width="75" HorizontalAlignment="Right" />
    </Grid>

    <Grid Grid.Column="2" Grid.Row="2" Grid.RowSpan="3">
      <Grid.RowDefinitions>
        <RowDefinition Height="auto" />
        <RowDefinition Height="*" />
        <RowDefinition Height="*" />
        <RowDefinition Height="auto" />
      </Gri
Here's what the end result SHOULD look like:
Steven Kirk
@grokys
Jan 22 18:33
This message was deleted
the markup was cut off, but you only have one child of the Window, right?
it's strange, it's saying that the Window content is already set to Window... you can't add a window to a window...
do you have a public repo i can look at?
StatesAndCapitalsAvalonia is the Avalonia version. The completed WPF version is in StatesAndCapitals.
It was a Visual Basic project that was due in a college course. I ported it over to WPF just for fun and then I heard about Avalonia, and thought it would be interesting to try and port it over so it could run natively on Ubuntu.
I should point out the VB project was WinForms.
you've got the closing > for the Window on the line before
it thinks Title="MainWindow" Background="#FFB0EDEE" Width="884.666" Height="586.282"> is content
<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        x:Class="StatesAndCapitalsAvalonia.MainWindow"> <------ CLOSING BRACE HERE
        Title="MainWindow" Background="#FFB0EDEE"  Width="884.666" Height="586.282">
M. Gage Morgan
@MGageMorgan
Jan 22 18:42
I erased it, and now it's back to telling me indiana.png can't be found again.
Steven Kirk
@grokys
Jan 22 18:42
:point_up: look at line 3
ok
M. Gage Morgan
@MGageMorgan
Jan 22 18:45
Portable.Xaml.XamlObjectWriterException
  HResult=0x80131500
  Message=Could not convert object '/Images/indiana.png' (of type System.String) to {clr-namespace:Avalonia.Media.Imaging;assembly=Avalonia.Visuals}IBitmap: The resource /Images/indiana.png could not be found.
  Source=Avalonia.Markup.Xaml
  StackTrace:
   at Portable.Xaml.XamlObjectWriterInternal.GetCorrectlyTypedValue(XamlMember xm, XamlType xt, Object value)
   at Portable.Xaml.XamlObjectWriterInternal.StoreAppropriatelyTypedValue(ObjectState state, MemberAndValue ms, Object obj, Object keyObj)
   at Portable.Xaml.XamlObjectWriterInternal.OnWriteValue(Object value)
   at Portable.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoader.LoadFromReader(XamlReader reader, AvaloniaXamlContext context, IAmbientProvider parentAmbientProvider)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(Stream stream, Assembly localAssembly, Object rootInstance, Uri uri)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(Type type, Object rootInstance)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(Object obj)
   at StatesAndCapitalsAvalonia.MainWindow.InitializeComponent() in C:\Users\gagem\Documents\GitHub\WPFProjects\StatesAndCapitalsAvalonia\StatesAndCapitalsAvalonia\MainWindow.xaml.cs:line 19
   at StatesAndCapitalsAvalonia.MainWindow..ctor() in C:\Users\gagem\Documents\GitHub\WPFProjects\StatesAndCapitalsAvalonia\StatesAndCapitalsAvalonia\MainWindow.xaml.cs:line 11

Inner Exception 1:
FileNotFoundException: The resource /Images/indiana.png could not be found.
To be clear, AvaloniaResource is being used in the csproj.
Steven Kirk
@grokys
Jan 22 18:45
yeah i saw that
M. Gage Morgan
@MGageMorgan
Jan 22 18:46
It's what @kekekeks was telling me to do, but that hasn't fixed the problem.
Steven Kirk
@grokys
Jan 22 18:51
you need to change it to <AvaloniaResource Include="Images/*.png" />
you previously had <AvaloniaResource Include="*/Images/*.png" /> which is looking for Images directories in subdirectories only, not in the main project directory
M. Gage Morgan
@MGageMorgan
Jan 22 18:57
Steven Kirk
@grokys
Jan 22 18:58
cool :)
M. Gage Morgan
@MGageMorgan
Jan 22 18:59
Is there a reason grids aren't working properly? It's supposed to display like:
Steven Kirk
@grokys
Jan 22 19:00
hmm, that could be related to AvaloniaUI/Avalonia#2139
M. Gage Morgan
@MGageMorgan
Jan 22 19:01
Okay, so it's not just me botching my XAML?
Steven Kirk
@grokys
Jan 22 19:01
it's strange though, because it displays properly in the designer
no, i suspect it might be a bug in our grid
we might need to take WPF's Grid class when it gets open-sourced
@walterlv are you still around? there seems to be some problems with our grid
@MGageMorgan i've got to go out very soon, but i'll take more of a look tomorrow
mstr2
@mstr2
Jan 22 19:03
Could there be an argument to be made to basically take all of WPF's layout containers to even out all of the edge cases that might pop up for a long time to come?
Steven Kirk
@grokys
Jan 22 19:03
yeah there definitely could
though it's not like WPF's containers are without bugs :/
mstr2
@mstr2
Jan 22 19:03
true, but by this time, the bugs are basically baked into the community knowledge
Steven Kirk
@grokys
Jan 22 19:04
WPF's grid is very buggy itself, just in different places to ours
yeah
M. Gage Morgan
@MGageMorgan
Jan 22 19:04
Would they still be cross-plat if taken directly from WPF? I've been following the thread about making WPF itself cross-plat, and it's pretty unfortunate. I like how robust WPF is.
Steven Kirk
@grokys
Jan 22 19:06
yeah, they'd still be x-plat. we'd just take the layout parts and port them
even better would be if MS published an extensive test suite. according to @walterlv's measurements our grid is faster than WPF's
M. Gage Morgan
@MGageMorgan
Jan 22 19:06
Okay, so right now I'm at an impasse until this is fixed, right?
Steven Kirk
@grokys
Jan 22 19:06
so if there were just a few failing tests we could just fix those. not sure
oooh actually, this doesn't look like a problem with Grid. looks like Image not calculating its size properly
that's much easier to fix
@MGageMorgan could you add an issue? will fix tomorrow morning
in the meantime, you could resize your images to the size they'll be displayed and that should fix it for now
ok, gtg, have a good one everyone
M. Gage Morgan
@MGageMorgan
Jan 22 20:18
I opened #2260 for it.
Steven Kirk
@grokys
Jan 22 21:03
Thanks!
Nikita Tsukanov
@kekekeks
Jan 22 21:04
Ah, images
Had autosizing issues with those
M. Gage Morgan
@MGageMorgan
Jan 22 21:07
@kekekeks Yeah, that's a better way to phrase it than what I put in the ticket
M. Gage Morgan
@MGageMorgan
Jan 22 21:13
Any chance there will be things like ResizeMode attributes for the <Window> tag?