These are chat archives for AvaloniaUI/Avalonia

23rd
Mar 2018
Igor Gritsenko
@Igor_Gritsenko_twitter
Mar 23 2018 11:35

Ensure that restore has run and that you have included 'netcoreapp2.0' in the TargetFrameworks for your project

same thing started after I installed Android SDK...

but maybe coincidence
Jonas Jermann
@jjermann
Mar 23 2018 15:15
Hi, I get the following error when trying to create a RoslynCodeEditor: Unhandled Exception: System.TypeLoadException: Method 'get_CanHorizontallyScroll' in type 'AvaloniaEdit.Editing.TextArea' from assembly 'AvaloniaEdit, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
danwalmsley
@danwalmsley
Mar 23 2018 15:21
@jjermann you will need to talk to Eli about that it looks like RoslynPad assemblies are out of date with the version of AvaloniaEdit you are using
Igor Gritsenko
@Igor_Gritsenko_twitter
Mar 23 2018 15:22
image.png
Jonas Jermann
@jjermann
Mar 23 2018 15:22
I used the latest version from Nuget, hmm
Igor Gritsenko
@Igor_Gritsenko_twitter
Mar 23 2018 15:22
TextBlock are binded ok. but button is not
Jonas Jermann
@jjermann
Mar 23 2018 15:22
(for RoslynPad)
Igor Gritsenko
@Igor_Gritsenko_twitter
Mar 23 2018 15:22
any ideas where to look else?
danwalmsley
@danwalmsley
Mar 23 2018 15:24
@Igor_Gritsenko_twitter you probably dont have a datacontext set in the designer
if you run it, it probably will show text?
Igor Gritsenko
@Igor_Gritsenko_twitter
Mar 23 2018 15:25
I'm talking about runtime
when I run app, text is set as expected, but command is not binded to button
so no effect, when I click it
danwalmsley
@danwalmsley
Mar 23 2018 15:27
what does GetCommand look like?
Igor Gritsenko
@Igor_Gritsenko_twitter
Mar 23 2018 15:28
It creates ICommand instance.
but it's not called anyway after app launch
I also tried to use jsut method name instead command with no effect either
danwalmsley
@danwalmsley
Mar 23 2018 15:29
Try this
inherit from ReactiveObject (its part of avalonia)
then change your command declaration to
public ReactiveCommand SelectToolCommand {get;}
then in ctor
SelectToolCommand = ReactiveCommand.Create(()=>{ // code to run on click});
then run your code and see if you hit a breakpoint where i put the comment
that will confirm if bindings are working correctly
GetCommand method might not work if it returns a different instance each time its accessed.
Igor Gritsenko
@Igor_Gritsenko_twitter
Mar 23 2018 17:13

Not helped.. and actually I need ICommand exactly.

and if I do direct set of Command it's working

        var butt = this.FindControl<Button>("myBut");
        butt.Command = vm.SelectToolCommand;
but not
<Button x:Name="myBut" Command="{Binding SelectToolCommand}">
Igor Gritsenko
@Igor_Gritsenko_twitter
Mar 23 2018 20:03
Hmm... Finally it works.. after I added nuget: System.ComponentModel.Annotations to project
Steven Kirk
@grokys
Mar 23 2018 22:32
hmm, are our packages missing a dependency?