These are chat archives for AvaloniaUI/Avalonia

18th
Apr 2018
lindexi
@lindexi
Apr 18 2018 05:10
but Microsoft make xarmain can use wpf.
Edward Krill
@scherenhaenden_twitter
Apr 18 2018 05:51
@lindexi wpf is one the most horrible things ive done this year... it looks like crap...
ive done it before... but srly... we are in 2018... and that looks... so 1995
walterlv
@walterlv
Apr 18 2018 06:20
@scherenhaenden_twitter You mean the Xamarin.Wpf or Avalonia?
Edward Krill
@scherenhaenden_twitter
Apr 18 2018 09:20
i said "WPF"...
if Avalonia where that to me... i would not be here :S
walterlv
@walterlv
Apr 18 2018 09:21
Excellent
Edward Krill
@scherenhaenden_twitter
Apr 18 2018 09:21
were*... autocorrection :S
walterlv
@walterlv
Apr 18 2018 09:22
But you said that you did something of WPF this year.
Edward Krill
@scherenhaenden_twitter
Apr 18 2018 09:22
yep... i had to... someone you are free like a dolphin... and you just swim through the ocean looking for food, sex and happiness...
then... u land on a company that use WPF
uses*
walterlv
@walterlv
Apr 18 2018 09:24

Edward Krill
@scherenhaenden_twitter
Apr 18 2018 09:24
and also windows... ugh... im about to cry here... cuz now to use monodevelop in windows is very difficult... i had to use VisualStudio... rethiking to come back to Java... or something on where i can use Linux or at Linux Mono...
but i wanna use this Avalonia... ive could not touch it yet... but im very excited about it... it looks like something big is about come
danwalmsley
@danwalmsley
Apr 18 2018 09:39
@scherenhaenden_twitter if its IDE support you need, we have a getting close to stable IDE AvalonStudio with XAML previewer, can support any dotnet project, windows / Linux / mac
its still beta so there are bugs
but people are starting to use it
Edward Krill
@scherenhaenden_twitter
Apr 18 2018 09:40
@danwalmsley <3!
Matthijs ter Woord
@mterwoord
Apr 18 2018 09:47
@danwalmsley there's debgger support yet?
danwalmsley
@danwalmsley
Apr 18 2018 09:49
yes debugger works, although its the most under-developed part
you can step through
breakpoints
inspect locals, variables add watches
Matthijs ter Woord
@mterwoord
Apr 18 2018 09:50
how pluggable is it?
danwalmsley
@danwalmsley
Apr 18 2018 09:50
with a bit of help, it wont take much to finish the debugger support
you mean for extensions and stuff?
Matthijs ter Woord
@mterwoord
Apr 18 2018 09:50
yes
danwalmsley
@danwalmsley
Apr 18 2018 09:50
its built from ground up to be completely extensible
what would you want to do?
Matthijs ter Woord
@mterwoord
Apr 18 2018 09:51
just thinking out loud here, but Cosmos has a custom debugger engine for vs...
danwalmsley
@danwalmsley
Apr 18 2018 09:52
its not the debugger engine, that's lacking, we have the same one that monodevelop use
and directly call the clr debugger
its the debugger controls / ui that's lacking
btw does your cosmos debugger engine have ability to step from managed to native code?
Matthijs ter Woord
@mterwoord
Apr 18 2018 09:53
cosmos compiles .net code to assembler, our debug engine has the ability to step on a per assembly-level instruction leve
danwalmsley
@danwalmsley
Apr 18 2018 09:54
so you are stepping x86 instructions or msil?
Matthijs ter Woord
@mterwoord
Apr 18 2018 09:56
both
but it then runs in a vm (or physical machine)
danwalmsley
@danwalmsley
Apr 18 2018 10:04
I'm sure a some point we could integrate it
maybe add support for cosmos potentially
Matthijs ter Woord
@mterwoord
Apr 18 2018 10:06
not sure what the current state is for using cosmos on linux..
were kind of "understaffed", bu thats a common thing with great os projects before the big breakthruogh...
danwalmsley
@danwalmsley
Apr 18 2018 10:17
@kekekeks fix to Avalonia.IDE
kekekeks/Avalonia.Ide#8
please can you merge asap thanks
FuadNagiyev
@FuadNagiyev
Apr 18 2018 10:20
Hello Guys,
I'm new in Avalonia, but I have a WPF background. May be it is not the correct room, where I am asking - but I have some generell questions concerning Avalonia, because of missing Avalonia Documentation.
I have a button in my XAML and I want to set there a click event (it should open an OpenFolderDialog). How could I do it? I mean there is unfortunately no Click event, which I could write into the XAML code.
danwalmsley
@danwalmsley
Apr 18 2018 10:22
@FuadNagiyev you need to subscribe to click event in code behind, or better to take the mvvm approach
I will try find an example
FuadNagiyev
@FuadNagiyev
Apr 18 2018 10:25
@danwalmsley I'm trying it also in mvvm, but it a little bit complicated. An example would be perfect - thank you in advance.
danwalmsley
@danwalmsley
Apr 18 2018 10:29
I'm just putting a quick one together for you
FuadNagiyev
@FuadNagiyev
Apr 18 2018 10:32
@danwalmsley thanks a lot
Steven Kirk
@grokys
Apr 18 2018 10:35
remember that in Avalonia you can bind a Command to a method, which might be the easiest way to do it: see "Binding to Methods" at http://avaloniaui.net/docs/binding/binding-to-commands
danwalmsley
@danwalmsley
Apr 18 2018 10:36
ill create an example with all 3
I'm thinking we should create a repo
with lots of simple examples like this
@grokys does that make commands pretty much redundant?
Steven Kirk
@grokys
Apr 18 2018 10:38
not really because commands also have the CanExecute state
but if you have a command that can always be executed then you can just use a method
FuadNagiyev
@FuadNagiyev
Apr 18 2018 10:38
I'll just take a look
danwalmsley
@danwalmsley
Apr 18 2018 10:50
@FuadNagiyev here is a repo with code behind click example
I will add the mvvm ones now
danwalmsley
@danwalmsley
Apr 18 2018 11:02
@FuadNagiyev ok there is now an example of mvvm using command binding and method binding
FuadNagiyev
@FuadNagiyev
Apr 18 2018 11:02
@danwalmsley ok thanks a lot - I'll take a look
danwalmsley
@danwalmsley
Apr 18 2018 11:03
@grokys what do you think of a repo like this iv just create with lots of very minimal examples of individual features
?
we can then link to them from documentation perhaps
FuadNagiyev
@FuadNagiyev
Apr 18 2018 11:05
I - as a consumer (at the moment) - would be really grateful, if you could provide such a repo with simple minimal examples.
By the way - the topics, to which I can provide examples - I would provide, too :)
@danwalmsley - thanks a lot - you example helps a lot
Wiesław Šoltés
@wieslawsoltes
Apr 18 2018 11:13
Matthijs ter Woord
@mterwoord
Apr 18 2018 11:13
@danwalmsley What's the design type in that main window?
danwalmsley
@danwalmsley
Apr 18 2018 11:19
allows you to tell the designer a viewmodel just for design time
so your preview can be populated with dummy data
among other things
Matthijs ter Woord
@mterwoord
Apr 18 2018 11:21
ah oke, how about using the same thing as wpf and uwp for that?
(d:datacontext)
danwalmsley
@danwalmsley
Apr 18 2018 11:21
you would have to check with @kekekeks on that one
Matthijs ter Woord
@mterwoord
Apr 18 2018 11:22
just mentioning it.. :)
Steven Kirk
@grokys
Apr 18 2018 11:26
@danwalmsley i think that would be a great idea
Design.DataContext="{x:Static Designer:DesignerContext.ArgbColor}"
Matthijs ter Woord
@mterwoord
Apr 18 2018 11:29
?
Wiesław Šoltés
@wieslawsoltes
Apr 18 2018 11:30
This is design time data context in Xaml previewer when using MVVM + Avalonia
In WPF its: d:DataContext="{x:Static designer:DesignerHelper.ArgbColor}"
Matthijs ter Woord
@mterwoord
Apr 18 2018 11:32
ah, yeah, understand what it is now, but would it be an idea to use the wpf/uwp version ? (or at least support it)
Wiesław Šoltés
@wieslawsoltes
Apr 18 2018 11:34
You still can not reuse 100% of Xaml from WPF
Matthijs ter Woord
@mterwoord
Apr 18 2018 11:35
i know, but might give some support for othter tooling
(think, resharper)
Wiesław Šoltés
@wieslawsoltes
Apr 18 2018 11:39
I do not use resharper, so can not comment of benefits. I edit my xaml manually 100% of the time :smile:
Matthijs ter Woord
@mterwoord
Apr 18 2018 11:45
poor you...
Wiesław Šoltés
@wieslawsoltes
Apr 18 2018 11:46
Ctrl+C -> Ctrl+V for xaml works great for me
Especially when I use similar concepts for my views
and using data binding all the way
Jumar Macato
@jmacato
Apr 18 2018 11:47
@wieslawsoltes hey i tested corert + core2D yesterday, same error as you got on windows, the fix is not trivial apparently :(
Wiesław Šoltés
@wieslawsoltes
Apr 18 2018 11:47
Yeah
Using dependency injection, IoC and MEF in any form will cause lot of pain with CoreRT
Matthijs ter Woord
@mterwoord
Apr 18 2018 11:48
add reflection to that mix ;)
Jumar Macato
@jmacato
Apr 18 2018 11:48
even simple reflection
yeah :/
Wiesław Šoltés
@wieslawsoltes
Apr 18 2018 11:49
well reflection is less of issue, more of pain :smile:
and time consuming
Jumar Macato
@jmacato
Apr 18 2018 11:49
haha right :)
Wiesław Šoltés
@wieslawsoltes
Apr 18 2018 11:49
But rewriting code that uses IoC concepts is another story :fire:
They need to provide some roslyn analyzers :smile:
@jmacato Something like this for CoreRT :fire:
Jumar Macato
@jmacato
Apr 18 2018 11:54
that'll be really neat to have :D
Wiesław Šoltés
@wieslawsoltes
Apr 18 2018 11:55
Jumar Macato
@jmacato
Apr 18 2018 11:59
that surely applies to CoreRT, for now at least
Wiesław Šoltés
@wieslawsoltes
Apr 18 2018 12:01
I need to debug Core2D and check what works with Autofac
🕹️ Des Mayer
@DesmondMayer_twitter
Apr 18 2018 12:27
I am trying to create a proof on concept for hosting a AvaloniaUI inside a WInform (like you can do with WPF). Is this possible?
Matthijs ter Woord
@mterwoord
Apr 18 2018 12:29
you could cheat by embedding the wpf control in winforms..
🕹️ Des Mayer
@DesmondMayer_twitter
Apr 18 2018 12:31
can I then host the Avalonia XAML in this?
Matthijs ter Woord
@mterwoord
Apr 18 2018 12:31
probably
as winforms is hositn wpf, which is then hosting avalonia
🕹️ Des Mayer
@DesmondMayer_twitter
Apr 18 2018 12:32
Makes sense. In theory then I should be able to place an Element Host on the form and point that to the XAML
Matthijs ter Woord
@mterwoord
Apr 18 2018 12:32
y
i'd sugest looking for a cleaner solution though
🕹️ Des Mayer
@DesmondMayer_twitter
Apr 18 2018 12:34
Yeah, this is what I am looking for. Was hoping there was a control that could be placed in the Winform
danwalmsley
@danwalmsley
Apr 18 2018 13:08
@DesmondMayer_twitter I'm not 100% sure but I think @kekekeks has either embedded inside wpf or winforms before
check his repositories to see if there is a repo of that description
🕹️ Des Mayer
@DesmondMayer_twitter
Apr 18 2018 13:10
@danwalmsley I am looking at that now but having no luck getting the sample to run. Still trying atm
Wiesław Šoltés
@wieslawsoltes
Apr 18 2018 13:21
@jmacato Fixed previous exception with Core2D, got new one :smile:
Core2D.Avalonia Error: 0 : Exception has been thrown by the target of an invocation.
   at System.InvokeUtils.CallDynamicInvokeMethod(Object, IntPtr, Object, IntPtr, IntPtr, Object, Object[], BinderBundle, Boolean, Boolean, Boolean) + 0x3c0
   at Internal.Reflection.Execution.MethodInvokers.InstanceMethodInvoker.Invoke(Object, Object[], BinderBundle, Boolean) + 0x7e
   at Internal.Reflection.Core.Execution.MethodInvoker.Invoke(Object, Object[], Binder, BindingFlags, CultureInfo) + 0x45
   at System.Reflection.Runtime.MethodInfos.RuntimePlainConstructorInfo`1.Invoke(BindingFlags, Binder, Object[], CultureInfo) + 0x97
   at System.ActivatorImplementation.CreateInstance(Type, Boolean) + 0xd6
   at Portable.Xaml.XamlObjectWriterInternal.InitializeObjectIfRequired(Boolean, Boolean) + 0x35f
   at Portable.Xaml.XamlObjectWriterInternal.OnWriteStartObject() + 0x8a
   at Portable.Xaml.XamlServices.Transform(XamlReader, XamlWriter, Boolean) + 0x4e
   at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.LoadFromReader(XamlReader, AvaloniaXamlContext) + 0x33
   at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.Load(Stream, Object, Uri) + 0xb7
   at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.Load(Type, Object) + 0x15f
   at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.Load(Object) + 0x4c
   at Core2D.Avalonia.App.Start(IServiceProvider, AboutInfo) + 0x32b

Core2D.Avalonia Error: 0 : Exception has been thrown by the target of an invocation.
   at System.InvokeUtils.CallDynamicInvokeMethod(Object, IntPtr, Object, IntPtr, IntPtr, Object, Object[], BinderBundle, Boolean, Boolean, Boolean) + 0x3c0
   at Internal.Reflection.Execution.MethodInvokers.InstanceMethodInvoker.Invoke(Object, Object[], BinderBundle, Boolean) + 0x7e
   at Internal.Reflection.Core.Execution.MethodInvoker.Invoke(Object, Object[], Binder, BindingFlags, CultureInfo) + 0x45
   at System.Reflection.Runtime.MethodInfos.RuntimePlainConstructorInfo`1.Invoke(BindingFlags, Binder, Object[], CultureInfo) + 0x97
   at System.ActivatorImplementation.CreateInstance(Type, Boolean) + 0xd6
   at Portable.Xaml.XamlObjectWriterInternal.InitializeObjectIfRequired(Boolean, Boolean) + 0x35f
   at Portable.Xaml.XamlObjectWriterInternal.OnWriteStartObject() + 0x8a
   at Portable.Xaml.XamlServices.Transform(XamlReader, XamlWriter, Boolean) + 0x4e
   at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.LoadFromReader(XamlReader, AvaloniaXamlContext) + 0x33
   at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.Load(Stream, Object, Uri) + 0xb7
   at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.Load(Type, Object) + 0x15f
   at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.Load(Object) + 0x4c
   at Core2D.Avalonia!<BaseAddress>+0x167f449
   at System.InvokeUtils.CallDynamicInvokeMethod(Object, IntPtr, Object, IntPtr, IntPtr, Object, Object[], BinderBundle, Boolean, Boolean, Boolean) + 0x225
Jumar Macato
@jmacato
Apr 18 2018 13:23
nice, i do hope we could pinpoint the exact line+column of the error on the xaml itself...
it doesn't look like a missing type to me
Wiesław Šoltés
@wieslawsoltes
Apr 18 2018 13:23
Jumar Macato
@jmacato
Apr 18 2018 13:24
alright, i'll try that in a bit, i'm currently testing some stuff in AvalonStudio
danwalmsley
@danwalmsley
Apr 18 2018 13:24
@DesmondMayer_twitter which repo are you trying?
🕹️ Des Mayer
@DesmondMayer_twitter
Apr 18 2018 13:25
danwalmsley
@danwalmsley
Apr 18 2018 13:27
Oh I thought you might have found one example if embedding somewhere else
What's the issue building? You on Linux, mac or Windows?
🕹️ Des Mayer
@DesmondMayer_twitter
Apr 18 2018 13:28
I was looking at the samples/ folder and there is an embedding example there
on Windows
Severity Code Description Project File Line Suppression State
Error CS0103 The name 'InitializeComponent' does not exist in the current context WindowsInteropTest C:\Users\desmond.mayer\source\repos\Avalonia\samples\interop\WindowsInteropTest\EmbedToWpfDemo.xaml.cs 15 Active
Error CS0246 The type or namespace name 'MainView' could not be found (are you missing a using directive or an assembly reference?) WindowsInteropTest C:\Users\desmond.mayer\source\repos\Avalonia\samples\interop\WindowsInteropTest\EmbedToWpfDemo.xaml.cs 16 Active
Error CS0103 The name 'Host' does not exist in the current context WindowsInteropTest C:\Users\desmond.mayer\source\repos\Avalonia\samples\interop\WindowsInteropTest\EmbedToWpfDemo.xaml.cs 21 Active
Error CS0103 The name 'RightBtn' does not exist in the current context WindowsInteropTest C:\Users\desmond.mayer\source\repos\Avalonia\samples\interop\WindowsInteropTest\EmbedToWpfDemo.xaml.cs 22 Active
Also invalid markup on the XAML on <wpf:WpfAvaloniaHost >
danwalmsley
@danwalmsley
Apr 18 2018 13:49
ok i'll try take a look in a bit
🕹️ Des Mayer
@DesmondMayer_twitter
Apr 18 2018 13:53
thanks
🕹️ Des Mayer
@DesmondMayer_twitter
Apr 18 2018 14:13
@danwalmsley I have tried moving the code I need into another solution and I get this error; Could not CreateEmbeddableWindow(): IWindowingPlatform is not registered on this.avaloniaHost = new WinFormsAvaloniaControlHost();
Wiesław Šoltés
@wieslawsoltes
Apr 18 2018 15:38
@jmacato I think I have found the source of the issue.
Exactly Command="{x:Static Editor:ProjectEditorCommands.NewCommand}"
So binding to static command from xaml does trigger exception.
This is fixable
Jumar Macato
@jmacato
Apr 18 2018 15:58
@wieslawsoltes alright, some problem with the static typeresolvers perhaps?
Wiesław Šoltés
@wieslawsoltes
Apr 18 2018 15:58
probably
the property I bind to is static
set by Aufofac during initialization
Anyway need to do some more testing
Jumar Macato
@jmacato
Apr 18 2018 16:00
alright, goodluck
Wiesław Šoltés
@wieslawsoltes
Apr 18 2018 16:09
I can confirm, that the binding to static property as commands is cause.
2018-04-18_18-07-48.gif
Jumar Macato
@jmacato
Apr 18 2018 16:10
nice! :D
Wiesław Šoltés
@wieslawsoltes
Apr 18 2018 16:10
The rest seems to work as expected.
Jumar Macato
@jmacato
Apr 18 2018 16:10
i presume the sidebars were Autofac based?
Wiesław Šoltés
@wieslawsoltes
Apr 18 2018 16:10
No
All had commands, so I had to disable views
The views are Autofac based, the first screen is dashboard and second editor, all got discovered by Autofac :smile:
Have to go, but things look very good for CoreRT+AvaloniaUI+Core2D
The static commands was bad design anyway :fire:
Wiesław Šoltés
@wieslawsoltes
Apr 18 2018 19:15
I must say it again, this is so nice Command="{Binding $parent[ListBox].DataContext.OnOpenProject}"
Wiesław Šoltés
@wieslawsoltes
Apr 18 2018 19:22
@danwalmsley Good news is that the Xaml Behaviors work under CoreRT :smile:
Also looks like IoC works, at least Autofac in my case
Jeremy Koritzinsky
@jkoritzinsky
Apr 18 2018 19:36
IoC without dynamic assembly loading works. Dynamic assembly loading will not work.
Wiesław Šoltés
@wieslawsoltes
Apr 18 2018 19:37
So something like MEF will not work?
e.g. like external plugins
Jeremy Koritzinsky
@jkoritzinsky
Apr 18 2018 19:44
Yep
danwalmsley
@danwalmsley
Apr 18 2018 19:57
@grokys I'm trying to create an alternative template for treeview
so for example here:
image.png
you can see the treeview in the left of the screen
id like to change the template so that each level of the treeview becomes a dropdown with the items
do I just need to change the treeviewitem template? is what I'm suggesting even possible?
maybe i can just change itemspanel perhaps?