These are chat archives for AvaloniaUI/Avalonia

14th
May 2018
gleblebedev
@gleblebedev
May 14 2018 07:42
Hi all
A quick question - what would it take to add arrow keys support to navigation?
I need to make an interface compatible with smart TV remotes on Android.
Nikita Tsukanov
@kekekeks
May 14 2018 11:51
@grokys @jkoritzinsky Recent libSkiaSharp.so build is 8MB which is huge. Do we really need WebP and TIFF support?
I'm also not sure if we need PDF
On the other hand, these features might be required by the resulting app
Nikita Tsukanov
@kekekeks
May 14 2018 12:04
Also, SVG
Wiesław Šoltés
@wieslawsoltes
May 14 2018 13:11
I use all of this in Core2D
To export documents in different formats
:smile:
That is very important part of Core2D to be able to export your work into other portable document/image formats.
Nikita Tsukanov
@kekekeks
May 14 2018 14:00
Ah, ok
danwalmsley
@danwalmsley
May 14 2018 14:02
@grokys @walterlv ok I'm happy with the new Grid PR now...
In AS I had some weird XAML left in like this:
<Grid RowDefinitions="*,*">
    <StackPanel Orientation="Horizontal" Gap="4">
      <Grid Background="Red" Height="16" Width="16" />
      <TextBlock Text="Test" />
    </StackPanel>
  </Grid>
the new PR correctly renders this code like that
image.png
the current version renders it like:
image.png
I believe the new behaviour to be correct, do you agree?
@kekekeks do you agree first image is correctly rendered?
Nikita Tsukanov
@kekekeks
May 14 2018 14:05
When in doubt check what WPF renders
danwalmsley
@danwalmsley
May 14 2018 14:06
@kekekeks is there any reason this cant be approved yet ? AvaloniaUI/Avalonia#1574
Nikita Tsukanov
@kekekeks
May 14 2018 14:07
I think I've left a comment regarding the style management there
danwalmsley
@danwalmsley
May 14 2018 14:08
@kekekeks but that's not the responsibility of this PR, we need to get the person who implemented that to fix it
Nikita Tsukanov
@kekekeks
May 14 2018 14:08
It should be refactored, it will remain error-prone otherwise
danwalmsley
@danwalmsley
May 14 2018 14:08
I'm only interested in reversing the broken code at the moment
we need to get @commonguy to fix that
Nikita Tsukanov
@kekekeks
May 14 2018 14:09
Ah, ok
It still needs refactoring though
@danwalmsley @wieslawsoltes please check if updated Skia works for you on Linux
danwalmsley
@danwalmsley
May 14 2018 14:10
ok I will open an issue to remind the refactoring
@kekekeks will test shortly, thanks
Nikita Tsukanov
@kekekeks
May 14 2018 14:11
It should work on all supported platforms except CentOS 6 (which doesn't have a compatible libfontconfig version, unfortunately)
danwalmsley
@danwalmsley
May 14 2018 14:12
ok
will this will allow us to have GPU rendering on Linux shortly?
@kekekeks have you noticed a lot of the time when you close an avalonia app you are left with "Press any key to continue..." in the console window?
Nikita Tsukanov
@kekekeks
May 14 2018 14:15
Linux GPU rendering will require quite a bit of changes to that PR
Dariusz Komosiński
@MarchingCube
May 14 2018 14:15
There was a bug in SkiaSharp regarding text length calculation: mono/SkiaSharp@2f86d00
But this is easy fix to backport.
Nikita Tsukanov
@kekekeks
May 14 2018 14:17
Text rendering does work, just wraps text in a weird way
Dariusz Komosiński
@MarchingCube
May 14 2018 14:18
Well, it looks quite silly :smile: . But yeah depends on how you define "does not work".
Nikita Tsukanov
@kekekeks
May 14 2018 14:19
We'll probably merge the PR as is if I won't find any issues aside from non-portable OpenGL context management and initialization
Since it's definetely a step in the right direction
Dariusz Komosiński
@MarchingCube
May 14 2018 14:23
I have some ideas for further improvements like SkPaint pooling as SkPaint.ctor scores quite high up in profiler. But this is concern after we adjust and merge current PR.
Eventually would be nice to setup some rendering benchmark project so we can get some timings.
Nikita Tsukanov
@kekekeks
May 14 2018 14:36
That's weird, SkPaint creation is supposed to be free
We might be using too many SkPaint instances though
Steven Kirk
@grokys
May 14 2018 14:38
@danwalmsley excellent! do you want to do the merge?
danwalmsley
@danwalmsley
May 14 2018 14:39
ok will do once its all passed :)
Steven Kirk
@grokys
May 14 2018 14:39
seems like it's all passed!
danwalmsley
@danwalmsley
May 14 2018 14:40
woohoo! that's a big step forward on grid thanks @walterlv
Steven Kirk
@grokys
May 14 2018 14:41
yea definitely
walterlv
@walterlv
May 14 2018 14:41
image.png
You mean, this one?
danwalmsley
@danwalmsley
May 14 2018 14:41
yes
Steven Kirk
@grokys
May 14 2018 14:41
@walterlv SharedSizeScope next? :D
danwalmsley
@danwalmsley
May 14 2018 14:42
@grokys iv made a small change on AvaloniaUI/Avalonia#1544 to fix the issue for password char support
if you have chance we could get that merged pretty soon too :)
walterlv
@walterlv
May 14 2018 14:42
I found that the original one didn't implemented that yet. So we should determine the behavior of SharedSizeScope
danwalmsley
@danwalmsley
May 14 2018 14:44
@walterlv that is a really big missing feature!
would be great to have that by next release
danwalmsley
@danwalmsley
May 14 2018 14:49
anyone noticed this on .net core when closing your application
image.png
hmm only seems to happen when clicking Debug->Start without Debugging in Visual Studio
never mind
danwalmsley
@danwalmsley
May 14 2018 15:17
@kekekeks since changing to new SkiaSharp Linux native binaries and this latest skiasharp this ...
image.png
has change to ...
image.png
image.png
a bit weird
is this a bug in skiasharp do you think or a change in text api or something
Dariusz Komosiński
@MarchingCube
May 14 2018 15:21
@danwalmsley It is a bug that Skia fixed and we are still wrongly accounting for
danwalmsley
@danwalmsley
May 14 2018 15:21
ah @MarchingCube can you point me rougly where it is I can probably fix this quite quickly
Dariusz Komosiński
@MarchingCube
May 14 2018 15:22
I actually pointed that out before, let me find the link.
danwalmsley
@danwalmsley
May 14 2018 15:22
thanks
danwalmsley
@danwalmsley
May 14 2018 15:23
ah so when this PR is merge that will fix this?
Dariusz Komosiński
@MarchingCube
May 14 2018 15:23
Yep
danwalmsley
@danwalmsley
May 14 2018 15:23
ok
ok I will just test with your PR to check :)
Dariusz Komosiński
@MarchingCube
May 14 2018 15:24
That would be nice, I need some feedback anyway to see if something may be wrong :smile:
danwalmsley
@danwalmsley
May 14 2018 15:24
so basically your PR, on Windows makes stuff render on GPU instead
Dariusz Komosiński
@MarchingCube
May 14 2018 15:25
Yep, also fixes a few bugs in our Skia backend and cleans it up.
danwalmsley
@danwalmsley
May 14 2018 15:26
ok
Dariusz Komosiński
@MarchingCube
May 14 2018 15:26
The gpu part still requires some work to function reliably on all platforms.
danwalmsley
@danwalmsley
May 14 2018 15:26
just running now
Dariusz Komosiński
@MarchingCube
May 14 2018 15:26
And by default it renders using raster
danwalmsley
@danwalmsley
May 14 2018 15:26
but on windows its 100% running now
?
Dariusz Komosiński
@MarchingCube
May 14 2018 15:27
you need to pass a parameter in UseSkia
danwalmsley
@danwalmsley
May 14 2018 15:27
ok
Dariusz Komosiński
@MarchingCube
May 14 2018 15:27
As you can choose a backend now (Raster, OpenGL).
I guess eventually we can think about better way of providing that info (but right now raster is safe default)
danwalmsley
@danwalmsley
May 14 2018 15:28
when you tested it with avalonstudio did you have to make any mods?
Its crashing immediately for me
Dariusz Komosiński
@MarchingCube
May 14 2018 15:28
No, no modifications there.
Can you see the exception?
Did it run on Raster backend?
danwalmsley
@danwalmsley
May 14 2018 15:29
2 secs ill post
oh
'Could not load file or assembly 'SkiaSharp, Version=1.60.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'
walterlv
@walterlv
May 14 2018 15:30
AvaloniaUI/Avalonia#1516
danwalmsley
@danwalmsley
May 14 2018 15:30
I think its using 1.60.1 because of @kekekeks new LinuxNatives one
walterlv
@walterlv
May 14 2018 15:30
So this issue can be closed
danwalmsley
@danwalmsley
May 14 2018 15:30
done
Dariusz Komosiński
@MarchingCube
May 14 2018 15:32
Is there even a 1.60.1 release of SkiaSharp?
danwalmsley
@danwalmsley
May 14 2018 15:33
hmm no
I'm getting confused
I think its Avalonia.Skia.Linux.Natives needs updating perhap
its prob referencing the older version and downgrading it or something
Dariusz Komosiński
@MarchingCube
May 14 2018 15:34
Ah right, I still have old package referenced
As there was no new one ready yet
danwalmsley
@danwalmsley
May 14 2018 15:35
yeah updating that fixed it
Dariusz Komosiński
@MarchingCube
May 14 2018 15:35
I will update the PR later to sync that up
danwalmsley
@danwalmsley
May 14 2018 15:37
btw did you test avalonstudio with OpenGL?
its frozen my machine trying that
yeah I can only make it work on raster,
Dariusz Komosiński
@MarchingCube
May 14 2018 15:38
Not entirely sure, I tested Core2D for sure with Raster and OpenGL. But for AvalonStudio I am not 100% sure.
danwalmsley
@danwalmsley
May 14 2018 15:39
I can push a commit to develop branch on the AS repo
that you could build and see the crash?
Dariusz Komosiński
@MarchingCube
May 14 2018 15:39
Sure
Would help a lot
danwalmsley
@danwalmsley
May 14 2018 15:39
ok
btw did you do anything to improve text rendering?
Dariusz Komosiński
@MarchingCube
May 14 2018 15:40
Improving in terms of quality?
In general I haven't touched the text implementation, it still has some PRs incoming. Would need to clean it up eventually.
danwalmsley
@danwalmsley
May 14 2018 15:41
yeah on skia backend the fonts have always been a bit blurry
Dariusz Komosiński
@MarchingCube
May 14 2018 15:41
I noticed this as well, but didn't investigate yet
danwalmsley
@danwalmsley
May 14 2018 15:41
I saw on stack overflow that skiasharp people recommend to render the text like 2x or 3x the size
then scale back down
Dariusz Komosiński
@MarchingCube
May 14 2018 15:41
Basically supersampling for text :smile:
danwalmsley
@danwalmsley
May 14 2018 15:41
but I didn't know how to implement this so couldn't try it
I'll try and find it
Dariusz Komosiński
@MarchingCube
May 14 2018 15:42
In general we can play around with antialiasing settings
I don't think we have AA properly enabled right now
danwalmsley
@danwalmsley
May 14 2018 15:43
yeah in the past iv played with it
and not had much luck, Direct2d walks all over Skia for text rendering
however this might be the stackoverflow that says about oversampling
Peter Worden
@Sn3akyP3t3_gitlab
May 14 2018 15:46
Is it possible to add Avalonia to an existing project created for .NET core? All the tutorials I've seen create a new project so not sure if it can be done or how to go about it.
danwalmsley
@danwalmsley
May 14 2018 15:46
develop branch now has commit where it crashes
Dariusz Komosiński
@MarchingCube
May 14 2018 15:46
I will look into that for sure after I am done with current PR. Need to iron out the bugs first.
danwalmsley
@danwalmsley
May 14 2018 15:46
as long as you run it against your PR with latest master merged in
@MarchingCube ok sure just to make you aware of that
iv been trying to improve text for a long time
Dariusz Komosiński
@MarchingCube
May 14 2018 15:47
Text is always tricky, but D2D vs Skia difference is day and night in quality
danwalmsley
@danwalmsley
May 14 2018 15:47
do you have any clue on how I could hack the super sampling?
I think you seem to know quite a lot about skia ?
Dariusz Komosiński
@MarchingCube
May 14 2018 15:48
I am not an expert on Skia, I know some things about rendering though.
In general we could try to allocate a new render target for a text that is bigger by some factor. And then draw this render target to our destination, scaled down.
danwalmsley
@danwalmsley
May 14 2018 15:50
i was thinking it could be done somewhere on FormattedTextImpl?
Dariusz Komosiński
@MarchingCube
May 14 2018 15:50
I could probably also ask around in my company as I have some rendering engineers around.
probably it could be, but we need a surface for that.
Steven Kirk
@grokys
May 14 2018 15:51
@Sn3akyP3t3_gitlab yes it should be fine. just there's not any documentation for it ;)
danwalmsley
@danwalmsley
May 14 2018 15:51
@MarchingCube ok this is why OpenGL is freezing on AS
image.png
Steven Kirk
@grokys
May 14 2018 15:51
@danwalmsley yes i will review your PR shortly
danwalmsley
@danwalmsley
May 14 2018 15:52
@Sn3akyP3t3_gitlab
1) Add package reference to Avalonia.Desktop
then in your main method: add the following code:
using Avalonia;
public static AppBuilder BuildAvaloniaApp()
            => AppBuilder.Configure<App>()
                .UsePlatformDetect()
                .LogToDebug();
Dariusz Komosiński
@MarchingCube
May 14 2018 15:54
@danwalmsley OpenTK is added through Avalonia.Win32
danwalmsley
@danwalmsley
May 14 2018 15:54
then in main method
BuildAvaloniaApp().Start<MainWindow>();
that will open a main window
I will have to manually add Avalonia.Win32 then?
normally i get it from Avalonia.Desktop
Peter Worden
@Sn3akyP3t3_gitlab
May 14 2018 15:56
@danwalmsley Thanks! That's enough to get me started!
Dariusz Komosiński
@MarchingCube
May 14 2018 15:56
Should be added automatically, but I am not nuget specialist.
Maybe I messed something up with nuspec
I think I tested AvalonStudio before I added entry to NuSpec, so I had OpenTK added manually
Also my general question - what is the easiest way of getting AvalonStudio to run on my build of Avalonia. Before I played around with nuget packages.
danwalmsley
@danwalmsley
May 14 2018 15:58
ok so this is a horrible hack but there isn't a better way AFAIKT
in the scripts dir on avalonia repo
there is a powershell script called .\ReplaceNugetCache.ps1 0.6.2-build5122-beta
you run it like that
the argument has to match the nugget version avalonstudio or the app you wish to debug is targetting
btw building avalonia.win32 doesn't copy OpenTK to the output directory
Dariusz Komosiński
@MarchingCube
May 14 2018 16:03
I would probably need some help with nuget in that case, I just replicated nuspec part from other package.
danwalmsley
@danwalmsley
May 14 2018 16:05
@MarchingCube when you said you got AvalonStudio to reference it directly I just did this on AvalonStudio like so <PackageReference Include="OpenTK.NETCore" Version="1.1.2749.6433" />
but I also get the error
if I manually copy the DLL I then get
System.InvalidOperationException: 'Could not load SDL2.dll'
Dariusz Komosiński
@MarchingCube
May 14 2018 16:07
Are you running with all exceptions enabled?
danwalmsley
@danwalmsley
May 14 2018 16:07
I was :)
now it runs
Dariusz Komosiński
@MarchingCube
May 14 2018 16:08
I think it is checking for platform support by just trying to load different dlls
danwalmsley
@danwalmsley
May 14 2018 16:08
I just got this
image.png
ok I have to go, but nice work, looks like its not too far off :)
Dariusz Komosiński
@MarchingCube
May 14 2018 16:10
I will check it when I get back home
Peter Worden
@Sn3akyP3t3_gitlab
May 14 2018 16:24

@danwalmsley Is there an alternative approach that doesn't involve adding a reference? I'm unclear why, but I'm unable to add a reference to anything other than DLLs in this project. I'm not the original author so I'm not sure what would cause that. I was able to add as a nuget package, but I don't get very far without an error.

=> AppBuilder.Configure<App>() complains that "type or namespace "App" cannot be found.

Jeremy Koritzinsky
@jkoritzinsky
May 14 2018 16:30
You have to create an App class that derives from the Avalonia.Controls.Application class.
@danwalmsley @MarchingCube the new package references probably didn't work since the build script (which builds the packages) wasn't updated.
Peter Worden
@Sn3akyP3t3_gitlab
May 14 2018 16:35
@jkoritzinsky Thanks! I'll try that angle.
Jeremy Koritzinsky
@jkoritzinsky
May 14 2018 16:36
You'll need a MainWindow class as well for the startup window.
Peter Worden
@Sn3akyP3t3_gitlab
May 14 2018 17:15
@jkoritzinsky Got past that. I used https://github.com/AvaloniaUI/AvaloniaVS/tree/master/src/Templates/AvaloniaApplicationTemplate as a reference. Unfortunately, now I'm running into an error in App.xaml.cs
System.IO.FileNotFoundException
HResult=0x80070002
Message=Unable to find view for MyClass.App
Source=Avalonia.Markup.Xaml
Peter Worden
@Sn3akyP3t3_gitlab
May 14 2018 17:21
I wonder if this is due to the application being originally a desktop console application.
Jeremy Koritzinsky
@jkoritzinsky
May 14 2018 17:28
Do you have an App.xaml file? And is it marked as an EmbeddedResource?
Peter Worden
@Sn3akyP3t3_gitlab
May 14 2018 17:32

@jkoritzinsky I do, its at the same folder level as program.cs. I'm not sure how to check if embedded. I usually see a virtual folder with files in there that indicate that, but this project doesn't have that.

I may have found the problem, but don't yet know how to resolve. When opening App.xaml VS designer process crashed. I think I must be missing some default themes maybe?

<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"/>

Jeremy Koritzinsky
@jkoritzinsky
May 14 2018 17:35
I'm pretty sure it's not an EmbeddedResource. It wouldn't be by default. Go to the properties view for the file and change its type to EmbeddedResource.
Peter Worden
@Sn3akyP3t3_gitlab
May 14 2018 17:41
@jkoritzinsky Did the same for MainWindow and Boom it works! You sir are a god among men :) Many thanks!
Dariusz Komosiński
@MarchingCube
May 14 2018 17:57
@jkoritzinsky I did update the packages.cake and added an entry in Avalonia.Win32, do I have to do anything else?
Jeremy Koritzinsky
@jkoritzinsky
May 14 2018 18:00
No that should be it. I'm not sure.
Maybe it's because Dan was using the replace script instead of restoring from a package reference
Peter Worden
@Sn3akyP3t3_gitlab
May 14 2018 18:31

I hate taxing this group for my meager questions, but I've exhausted the useful Google search results and I'm getting nowhere.

I think, not sure, that Label and TextBox are not yet available in Avalonia. Is that correct? If so, what is the recommended way to substitute them?

Wiesław Šoltés
@wieslawsoltes
May 14 2018 18:32
TextBlock for Label
TextBox is available
Peter Worden
@Sn3akyP3t3_gitlab
May 14 2018 18:32
K, I was working through the errors and trusted my findings here http://avaloniaui.net/docs/controls/textblock
Figured that was a sign that it wasn't yet implemented.
Glad to find that's not the case :)
Lots of sample Xaml
Peter Worden
@Sn3akyP3t3_gitlab
May 14 2018 18:38
@wieslawsoltes That's a far better resource than anything I've stumbled across so far. Thanks!
Wiesław Šoltés
@wieslawsoltes
May 14 2018 18:39
:smile:
Peter Worden
@Sn3akyP3t3_gitlab
May 14 2018 19:03
Sorry about all these questions. I'm not finding a replacement for TextChanged under TextBox.
Steven Kirk
@grokys
May 14 2018 19:05
@Sn3akyP3t3_gitlab we don't have that event yet unfortunately
if you just want to see what the current text is, you can just listen to the TextProperty.
Wiesław Šoltés
@wieslawsoltes
May 14 2018 19:06
Steven Kirk
@grokys
May 14 2018 19:06
@Sn3akyP3t3_gitlab see here for how to listen to the text property http://avaloniaui.net/docs/binding/binding-from-code
Peter Worden
@Sn3akyP3t3_gitlab
May 14 2018 19:07
@grokys Sorry, I was a little late. I just stumbled across this and see its not yet available. AvaloniaUI/Avalonia#418 I'll try your suggestion(s).
Steven Kirk
@grokys
May 14 2018 19:09
our PR list is getting out of control
i don't know where to start!
Peter Worden
@Sn3akyP3t3_gitlab
May 14 2018 19:14
@grokys Don't lose your focus. Ignore my interest in a particular missing feature. Popularity vote shouldn't shift existing priorities.
Steven Kirk
@grokys
May 14 2018 19:15
thanks - no, the problem is just not enough time and too many PRs ;)
Peter Worden
@Sn3akyP3t3_gitlab
May 14 2018 19:15
Not enough cooks and wildly popular soup!
Steven Kirk
@grokys
May 14 2018 19:17
hehe yeah something like that!
Alex
@awulkan
May 14 2018 19:20
Wow @wieslawsoltes , Almost 7000 commits to that Core2D project, and you're the only contributor.
That's dedication.
Wiesław Šoltés
@wieslawsoltes
May 14 2018 19:20
:smile:
Alex
@awulkan
May 14 2018 19:21
:clap:
Wiesław Šoltés
@wieslawsoltes
May 14 2018 19:21
The project is developed for long time.
Alex
@awulkan
May 14 2018 19:22
I usually give up after about 20-30 commits. :)
I guess I never found something worth developing.
hey 7007 commits now, just refreshed the page.
Wiesław Šoltés
@wieslawsoltes
May 14 2018 19:22
Yeah
I am working on Docking for AvaloniaUI
Alex
@awulkan
May 14 2018 19:23
Looks cool
Wiesław Šoltés
@wieslawsoltes
May 14 2018 19:23
Alex
@awulkan
May 14 2018 19:23
Yes, I saw
danwalmsley
@danwalmsley
May 14 2018 19:23
@wieslawsoltes can you drag a window title bar back into the main ui?
Wiesław Šoltés
@wieslawsoltes
May 14 2018 19:24
Window no
danwalmsley
@danwalmsley
May 14 2018 19:24
To Dock all tabs within child widow?
Wiesław Šoltés
@wieslawsoltes
May 14 2018 19:24
But you can drag back tab items
Not sure how too hook this up
Dariusz Komosiński
@MarchingCube
May 14 2018 19:25
@danwalmsley Testing AvalonStudio with my PR, interestingly it "works on my machine". Could you tell me what was the stacktrace when it crashed for you?
Wiesław Šoltés
@wieslawsoltes
May 14 2018 19:25
Probably need to use custom window decorations
And add drag event to custom window title-bar
danwalmsley
@danwalmsley
May 14 2018 19:38
@MarchingCube I'll have a look shortly not at PC right now
It was mainly it couldn't find opentk
The sdl.dll or something
Peter Worden
@Sn3akyP3t3_gitlab
May 14 2018 19:40
Is this the preferred way to map variables from .xaml.cs to .xaml?
private TextBlock _local = this.FindControl<TextBlock>("FromXaml");
Jeremy Koritzinsky
@jkoritzinsky
May 14 2018 19:55
Yep.
Peter Worden
@Sn3akyP3t3_gitlab
May 14 2018 20:50
I'm playing whack-a-mole with the remaining issues and I'm grateful for the progress so far! Its looking good and I'm not backing down :) My two current issues are:
1.) The button created seems to be disabled or read-only and I'm not sure because its generated as IsEnabled="True" and not modified after.
2.) What is "MyControl" in reference to from the "Subscribing to a Property on Any Object" section of http://avaloniaui.net/docs/binding/binding-from-code ?
Peter Worden
@Sn3akyP3t3_gitlab
May 14 2018 21:34
I was able to solve #2 with
controlVar.GetObservable(TextBox.TextProperty).Subscribe(text => { method(); });
Still puzzled with #1
Peter Worden
@Sn3akyP3t3_gitlab
May 14 2018 21:47
Looks like I don't have the button mapped to a command correctly. The disabled behavior went away when I removed
Command="{Binding Button_Click}"
Peter Worden
@Sn3akyP3t3_gitlab
May 14 2018 22:59
This would be my first go with a MVVM application. I believe I found that by needing to have command bindings on the button I had to create a viewmodel much like https://github.com/AvaloniaUI/Avalonia/blob/9ea7aa6214b41a915c482ffb558490679c04f374/samples/BindingTest/ViewModels/MainWindowViewModel.cs ,but after making this change I'm no longer able to access members of MainWindow.xaml like this
_input = this.FindControl<TextBox>("Input");
Jeremy Koritzinsky
@jkoritzinsky
May 14 2018 23:01
You can use the Click event instead of Commands if you want.
Peter Worden
@Sn3akyP3t3_gitlab
May 14 2018 23:13
@jkoritzinsky I probably should learn to do this the right way, buts its quite a struggle through trial and error :) Am I violating good design here by doing this in this manner trying to access from another .xaml file?
Jeremy Koritzinsky
@jkoritzinsky
May 14 2018 23:14
It's not really truly MVVM but for just prototyping or trying to fit Avalonia as a separate component of a larger project it's ok.
Peter Worden
@Sn3akyP3t3_gitlab
May 14 2018 23:15
Good enough for me :)
Peter Worden
@Sn3akyP3t3_gitlab
May 14 2018 23:43
@jkoritzinsky You wouldn't happen to have an example of that would you? I stumbled across a great example of different ways to register an event across various frameworks, but I can't seem to find it again nor can I find an example that calls the Click event. I thought I could repeat what I did with GetObservable(), but that seems to not work the way I'm trying to use it.
Jeremy Koritzinsky
@jkoritzinsky
May 14 2018 23:46
It should be the same as WPF.
Peter Worden
@Sn3akyP3t3_gitlab
May 14 2018 23:56
I'm probably close, but not on the money.
Portable.Xaml.XamlObjectWriterException: 'Could not convert object 'Button_Click' (of type System.String) to {clr-namespace:System;assembly=mscorlib}EventHandler({clr-namespace:Avalonia.Interactivity;assembly=Avalonia.Interactivity}RoutedEventArgs): Referenced value method Button_Click in type DK.Sell.View.Promises.In.ActiveOmni.MainWindow indicated by event System.EventHandler`1[[Avalonia.Interactivity.RoutedEventArgs, Avalonia.Interactivity, Version=0.6.0.0, Culture=neutral, PublicKeyToken=null]] was not found'
Click="Button_Click"
Jeremy Koritzinsky
@jkoritzinsky
May 14 2018 23:58
Did you make a method on your MainWindow class that takes two parameters: object and RoutedEventArgs?
Peter Worden
@Sn3akyP3t3_gitlab
May 14 2018 23:58
Oh... I just remembered I removed some params in the conversion. Probably the reason why it no worky worky.
Yeah, those two