These are chat archives for AvaloniaUI/Avalonia

7th
Jun 2018
Rayyan Tahir
@RayyanTahir
Jun 07 2018 06:11 UTC
I have a window with an Image control that shows a PNG from Assets folder. When I run the application from visual studio the Image renders, but when I publish the dotnet app and run the exe, the application fails to start. I found the issue after doing dotnet <Applicationname.dll> and got the following exception:
Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Portable.Xaml.XamlObjectWriterException: Could not convert object 'resm:DotnetPublishRepro.Assets.logo.png' (of type System.String) to {clr-namespace:Avalonia.Media.Imaging;assembly=Avalonia.Visuals}IBitmap: The type initializer for 'SkiaSharp.SKManagedStream' threw an exception. ---> System.TypeInitializationException: The type initializer for 'SkiaSharp.SKManagedStream' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'libSkiaSharp': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
   at SkiaSharp.SkiaApi.sk_managedstream_set_delegates(IntPtr pRead, IntPtr pPeek, IntPtr pIsAtEnd, IntPtr pRewind, IntPtr pGetPosition, IntPtr pSeek, IntPtr pMove, IntPtr pGetLength, IntPtr pCreateNew, IntPtr pDestroy)
   at SkiaSharp.SKManagedStream..cctor()
   --- End of inner exception stack trace ---
   at Avalonia.Skia.PlatformRenderInterface.LoadBitmap(Stream stream)
   at Avalonia.Media.Imaging.Bitmap..ctor(Stream stream)
   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.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.Load(Type type, Object rootInstance)
   at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.Load(Object obj)
   at DotnetPublishRepro.MainWindow.InitializeComponent() in C:\Users\Rayyan\Desktop\AvaloniaRepros\DotnetPublishRepro\MainWindow.xaml.cs:line 19
   at DotnetPublishRepro.MainWindow..ctor() in C:\Users\Rayyan\Desktop\AvaloniaRepros\DotnetPublishRepro\MainWindow.xaml.cs:line 11
   --- End of inner exception stack trace ---
   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.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance[T]()
   at Avalonia.Controls.AppBuilderBase`1.Start[TMainWindow](Func`1 dataContextProvider)
   at DotnetPublishRepro.Program.Main(String[] args) in C:\Users\Rayyan\Desktop\AvaloniaRepros\DotnetPublishRepro\Program.cs:line 11
I managed to create a repro as below:
ZZerker
@ZZerker
Jun 07 2018 10:04 UTC
Is there any good example multi platform projects for avalon? I struggle to get the one from the avalon repo to work.
danwalmsley
@danwalmsley
Jun 07 2018 10:05 UTC
yes AvalonStudio, Core2d
danwalmsley
@danwalmsley
Jun 07 2018 10:13 UTC
also there is much smaller simpler ControlCatalog
Дмитрий Чехлов
@kda2015_twitter
Jun 07 2018 10:14 UTC
will you move to gitlab?
danwalmsley
@danwalmsley
Jun 07 2018 10:15 UTC
I doubt it!
ZZerker
@ZZerker
Jun 07 2018 10:16 UTC
ah thanks
Дмитрий Чехлов
@kda2015_twitter
Jun 07 2018 10:19 UTC
Great!
Rayyan Tahir
@RayyanTahir
Jun 07 2018 10:19 UTC
@danwalmsley can you please take a quick look at my issue posted above?
danwalmsley
@danwalmsley
Jun 07 2018 10:21 UTC
@RayyanTahir il have a look shortly :)
Rayyan Tahir
@RayyanTahir
Jun 07 2018 10:22 UTC
Thanks! :smile:
Jeremy Koritzinsky
@jkoritzinsky
Jun 07 2018 12:30 UTC
Yeah considering @grokys works for Github I don't see us moving to GitLab haha.
danwalmsley
@danwalmsley
Jun 07 2018 13:52 UTC
@jkoritzinsky iv updated issue with a repro commit for you
Jeremy Koritzinsky
@jkoritzinsky
Jun 07 2018 13:53 UTC
Perfect! I'll take a look!
Jumar Macato
@jmacato
Jun 07 2018 13:53 UTC
image.png
Aero theme on Ubuntu :) courtesy of @Splitwirez
Splitwirez
@Splitwirez
Jun 07 2018 13:54 UTC
Oh god that looks so weird
:clap:
Jumar Macato
@jmacato
Jun 07 2018 13:54 UTC
currently using discount Segoe UI (Selawik)
:laughing:
Splitwirez
@Splitwirez
Jun 07 2018 13:55 UTC
lol
danwalmsley
@danwalmsley
Jun 07 2018 14:12 UTC
@jmacato or @jkoritzinsky this fixes a crash I introduced with last set of carousel fixes
perhaps one of you could give it a review?
Jumar Macato
@jmacato
Jun 07 2018 14:13 UTC
:+1:
Jeremy Koritzinsky
@jkoritzinsky
Jun 07 2018 14:14 UTC
:+1:
Jumar Macato
@jmacato
Jun 07 2018 14:16 UTC
will merge when CI passes @danwalmsley :))
danwalmsley
@danwalmsley
Jun 07 2018 14:17 UTC
thanks :)
danwalmsley
@danwalmsley
Jun 07 2018 14:26 UTC
@jkoritzinsky in the menuitem template there is
<Style Selector="MenuItem:selected /template/ Border#root">
    <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}"/>
    <Setter Property="BorderBrush" Value="{DynamicResource ThemeAccentBrush}"/>
  </Style>

  <Style Selector="MenuItem:pointerover /template/ Border#root">
    <Setter Property="Background" Value="{DynamicResource ThemeAccentBrush4}"/>
    <Setter Property="BorderBrush" Value="{DynamicResource ThemeAccentBrush}"/>
  </Style>
I'm not sure why there is one for selected, its causing AvaloniaUI/Avalonia#1664
I never thought you could actually select a menuitem
shall I remove the :selected style?
Jeremy Koritzinsky
@jkoritzinsky
Jun 07 2018 14:28 UTC
Sure! Make sure everything still works as expected in ControlCatalog tho.
Jumar Macato
@jmacato
Jun 07 2018 14:29 UTC
AppVeyor is taking a while to queue...
danwalmsley
@danwalmsley
Jun 07 2018 14:29 UTC
yeah seems to
weird thing is I don't understand why I'm seeing this now
it hadn't happened before
hmmm I think it needs more investigating obviously this was there before but :selected was getting removed
danwalmsley
@danwalmsley
Jun 07 2018 14:35 UTC
hmm I guess that its needed for keyboard nav
damn
which still doesn't work correctly
Benedikt Stebner
@Gillibald
Jun 07 2018 14:38 UTC
I wonder if SVG support would be a usefull feature to implement. Has anyone ever used vector graphics in their desktop applications?
Jumar Macato
@jmacato
Jun 07 2018 14:39 UTC
@Gillibald that would be super useful for logos, etc
danwalmsley
@danwalmsley
Jun 07 2018 14:39 UTC
yes, and uwp supports it
Jumar Macato
@jmacato
Jun 07 2018 14:40 UTC
@danwalmsley AppVeyor is taking a ridiculous amount of time to start
danwalmsley
@danwalmsley
Jun 07 2018 14:40 UTC
probably has a queue of other commits to deal with
Jumar Macato
@jmacato
Jun 07 2018 14:40 UTC
ohwell.. gotta wait before i merge #1655
danwalmsley
@danwalmsley
Jun 07 2018 14:41 UTC
48minutes something has gone wrong here
image.png
Jumar Macato
@jmacato
Jun 07 2018 14:41 UTC
finally! it started
some hiccups at their end perhaps?
danwalmsley
@danwalmsley
Jun 07 2018 14:42 UTC
I just cancelled the one that had gotten stuck
i dunno
Jumar Macato
@jmacato
Jun 07 2018 14:42 UTC
ohh
Jumar Macato
@jmacato
Jun 07 2018 14:56 UTC
@danwalmsley done merging #1655 !
there was alot of LangVersion warnings on Cake @ AppVeyor
Jeremy Koritzinsky
@jkoritzinsky
Jun 07 2018 14:59 UTC
Yeah those are from the JetBrains inspector.
Can someone take a look at my PR that cleans up our builds and gets the LeakTests running again?
#1663
Benedikt Stebner
@Gillibald
Jun 07 2018 15:07 UTC
Just thought that I already work on the PathMarkupParser why not add svg support too. We dont have to support all the aspects like Animation etc. but some part of the spec would be nice.
danwalmsley
@danwalmsley
Jun 07 2018 15:09 UTC
yeah nice idea
uwp doesn't support everything either
Splitwirez
@Splitwirez
Jun 07 2018 15:11 UTC
@Gillibald Does https://lawsonsmartoffice.files.wordpress.com/2011/06/lso_designer.png count as using vector graphics in a desktop application?
(not mine btw)
Splitwirez
@Splitwirez
Jun 07 2018 15:16 UTC
(this one is mine)
Jumar Macato
@jmacato
Jun 07 2018 15:33 UTC
@Splitwirez the last one is not vector graphics since it's reusing the icon resources (w/c is bitmap iirc) right?
i do wish Windows made some kind of vector icons support.
ahopper
@ahopper
Jun 07 2018 15:43 UTC
yep, the whole multi res cross platform icon thing is a mess, you could almost believe that graphic artists want to make a living
talking of which, has anyone got a clean way to use the vc image lib drawings from resources, I've got a load of code like this that is a bit messy
<ToggleButton Classes="toolbar" Name="buttonSettings" IsChecked="{Binding #Settings.IsOpen, Mode=TwoWay}" ClickMode="Press"  >      
        <DrawingPresenter>
          <DrawingPresenter.Drawing>
            <DrawingGroup>
              <DrawingGroup.Children>
                <GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" />
                <GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M6.2358,14.5L5.9698,12.901 4.6508,13.843 2.1568,11.35 3.0988,10.03 1.4998,9.764 1.4998,6.236 3.0988,5.97 2.1568,4.65 4.6518,2.157 5.9698,3.099 6.2358,1.5 9.7638,1.5 10.0298,3.099 11.3498,2.157 13.8428,4.651 12.9018,5.97 14.4998,6.236 14.4998,9.764 12.9018,10.03 13.8428,11.35 11.3498,13.843 10.0298,12.901 9.7638,14.5z" />
                <GeometryDrawing Brush="#FF424242" Geometry="F1M9.7382,8C9.7382,8.96 8.9602,9.738 8.0002,9.738 7.0402,9.738 6.2612,8.96 6.2612,8 6.2612,7.04 7.0402,6.262 8.0002,6.262 8.9602,6.262 9.7382,7.04 9.7382,8 M9.5432,4.274C9.4292,4.226,9.3112,4.205,9.1952,4.169L8.9172,2.5 7.0832,2.5 6.8052,4.167C6.5742,4.239,6.3492,4.332,6.1342,4.445L4.7592,3.463 3.4632,4.759 4.4462,6.136C4.3892,6.243 4.3212,6.342 4.2732,6.457 4.2262,6.571 4.2052,6.689 4.1692,6.805L2.5002,7.083 2.5002,8.916 4.1672,9.194C4.2392,9.426,4.3322,9.651,4.4452,9.866L3.4622,11.241 4.7592,12.537 6.1352,11.554C6.2432,11.61 6.3422,11.679 6.4562,11.726 6.5712,11.774 6.6892,11.795 6.8052,11.831L7.0832,13.5 8.9162,13.5 9.1942,11.833C9.4262,11.761,9.6512,11.668,9.8652,11.555L11.2412,12.537 12.5372,11.241 11.5542,9.864C11.6102,9.756 11.6782,9.658 11.7262,9.543 11.7742,9.429 11.7952,9.311 11.8312,9.195L13.5002,8.917 13.5002,7.084 11.8332,6.806C11.7612,6.574,11.6682,6.349,11.5552,6.134L12.5372,4.759 11.2412,3.463 9.8642,4.446C9.7562,4.39,9.6582,4.321,9.5432,4.274" />
              </DrawingGroup.Children>
            </DrawingGroup>
          </DrawingPresenter.Drawing>
        </DrawingPresenter>       
      </ToggleButton>
Splitwirez
@Splitwirez
Jun 07 2018 16:06 UTC
@jmacato The last one is almost entirely vector - the file/folder icons aren't, but everything else is. Also...vector icons, you say? adds to things-to-consider-doing list
Jumar Macato
@jmacato
Jun 07 2018 16:07 UTC
@Splitwirez yeah i was about to mention that technicality but i digressed :laughing:
Splitwirez
@Splitwirez
Jun 07 2018 16:07 UTC
Well the question was regarding Vector UI, not specifically Vector icons, was it not...?
Jumar Macato
@jmacato
Jun 07 2018 16:08 UTC
yeah, you got me pal :shipit:
Splitwirez
@Splitwirez
Jun 07 2018 16:08 UTC
P:
Jumar Macato
@jmacato
Jun 07 2018 16:13 UTC
@ahopper i think you could use a separate ResourceDictionary just like how you do it in WPF
ahopper
@ahopper
Jun 07 2018 16:17 UTC

yep I'm sure that would work, the raw files in the library have a wrapper arround

!-- This file was generated by the AiToXaml tool.-->
<!-- Tool Version: 14.0.22307.0 -->
<Viewbox Width="16" Height="16" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
  <Rectangle Width="16" Height="16">
    <Rectangle.Fill>
      <DrawingBrush>
        <DrawingBrush.Drawing>
          <DrawingGroup>
            <DrawingGroup.Children>
              <GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" />
              <GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M1.9998,-0.000199999999999534L1.9998,1.9998 -0.000199999999999978,1.9998 -0.000199999999999978,5.9998 1.9998,5.9998 1.9998,7.9998 5.0008,7.9998 5.0008,13.9998 15.9998,13.9998 15.9998,7.9998 6.0008,7.9998 6.0008,5.9998 7.9998,5.9998 7.9998,1.9998 6.0008,1.9998 6.0008,-0.000199999999999534z" />
              <GeometryDrawing Brush="#FF424242" Geometry="F1M14,12L7,12 7,10 14,10z M6,13L15,13 15,9 6,9z" />
              <GeometryDrawing Brush="#FFF0EFF1" Geometry="F1M14,12L7,12 7,10 14,10z" />
              <GeometryDrawing Brush="#FF388A34" Geometry="F1M7,3.0176L5,3.0176 5,0.9996 3.019,0.9996 3.019,3.0176 1,3.0176 1,4.9996 3.019,4.9996 3.019,6.9996 5,6.9996 5,4.9996 7,4.9996z" />
            </DrawingGroup.Children>
          </DrawingGroup>
        </DrawingBrush.Drawing>
      </DrawingBrush>
    </Rectangle.Fill>
  </Rectangle>
</Viewbox>

that I seem to have to remove, it would be nice to be able to just put the files directly as assets

Benedikt Stebner
@Gillibald
Jun 07 2018 16:23 UTC
I will implement a SvgImageSource. That way you can load a svg file from an asset.
Jumar Macato
@jmacato
Jun 07 2018 16:26 UTC
Sometime soon we will need a ViewBox control
Jeremy Koritzinsky
@jkoritzinsky
Jun 07 2018 16:27 UTC
I think @wieslawsoltes had a prototype of one about a year ago.
Don't know what happened to it though
ahopper
@ahopper
Jun 07 2018 16:27 UTC
That sounds good, now we have font embedding i guess the fonts from the metro project are another source of icons
Jumar Macato
@jmacato
Jun 07 2018 16:28 UTC
@jkoritzinsky his PanAndZoom control can be trimmed to do just the Viewbox stuff, right?
Jeremy Koritzinsky
@jkoritzinsky
Jun 07 2018 16:28 UTC
I think so.
Jumar Macato
@jmacato
Jun 07 2018 16:28 UTC
Right, hope he's not too busy later
this is quick and dirty version
danwalmsley
@danwalmsley
Jun 07 2018 17:21 UTC
@ahopper like this
ahopper
@ahopper
Jun 07 2018 17:53 UTC
@danwalmsley thanks
Benedikt Stebner
@Gillibald
Jun 07 2018 18:12 UTC
I will create a prototype for svg parsing an implement what is missing. This will make it easier to work with complex geometries as icons etc.
Splitwirez
@Splitwirez
Jun 07 2018 20:45 UTC
Question...what's the Avalonia equivalent of DependencyObject?
danwalmsley
@danwalmsley
Jun 07 2018 20:48 UTC
AvaloniaObject
Splitwirez
@Splitwirez
Jun 07 2018 20:49 UTC
o ok
Splitwirez
@Splitwirez
Jun 07 2018 21:00 UTC
Does ListView even exist, or...?
Wiesław Šoltés
@wieslawsoltes
Jun 07 2018 21:07 UTC
No
:worried:
Splitwirez
@Splitwirez
Jun 07 2018 21:08 UTC
k...guess I'll be doing some really weird styling on a TreeView, lol
danwalmsley
@danwalmsley
Jun 07 2018 21:26 UTC
@Splitwirez iv often used listbox but then set the itemspanel to stackpanel, or dockpanel or something like that
Splitwirez
@Splitwirez
Jun 07 2018 21:26 UTC
oh
...that could work too
danwalmsley
@danwalmsley
Jun 07 2018 21:26 UTC
what kind of layout are you wanting?
Splitwirez
@Splitwirez
Jun 07 2018 21:43 UTC
Well...ultimately, a Window with, basically, three content properties, so to speak...one of which contains two ListView-type things.
danwalmsley
@danwalmsley
Jun 07 2018 21:50 UTC
@wieslawsoltes @grokys @jkoritzinsky say you have a control that at is at the end of a visual hierarchy in the tree
and its contained inside say a border higher up the visual tree
the border control doesnt know anything about the control further down, say its a textbox
how can the border know when the textbox got focused
so essentially how do you see if the currently focused control is a child of a particular control?
Jeremy Koritzinsky
@jkoritzinsky
Jun 07 2018 21:52 UTC
If you want it as an event, there's the GotFocus event. Otherwise you could manually query the children.
danwalmsley
@danwalmsley
Jun 07 2018 21:53 UTC
GotFocus event doesnt get called
AFAIKT
event with tunneling
Jeremy Koritzinsky
@jkoritzinsky
Jun 07 2018 21:53 UTC
Sounds like the :has selector from CSS 4 (I think?)
danwalmsley
@danwalmsley
Jun 07 2018 21:53 UTC
:(
so my thoughts were to use PointerPressed event
and then check if the FocusManager maybe could tell me which control was focused?
Jeremy Koritzinsky
@jkoritzinsky
Jun 07 2018 21:55 UTC
Or subscribe to the IsFocused property from the Border and check if the sender is a child?
Your ideas are probably more performant
danwalmsley
@danwalmsley
Jun 07 2018 21:57 UTC
I guess you only get
_disposable = AssociatedObject.AddHandler(Control.GotFocusEvent, (sender, e) => 
            {
that if the control actually gets focus
which is why tunnelling doesnt work
so I think pointer pressed it will have to be :(
Jeremy Koritzinsky
@jkoritzinsky
Jun 07 2018 22:29 UTC
@danwalmsley OnGotFocus is only raised by keyboard focus. That might be part of the issue why the event isn't firing.
danwalmsley
@danwalmsley
Jun 07 2018 22:33 UTC
yeah probably
I think I have a good solution now :)