These are chat archives for AvaloniaUI/Avalonia

18th
May 2016
danwalmsley
@danwalmsley
May 18 2016 00:00
where does register services get called now?
Matthijs ter Woord
@mterwoord
May 18 2016 09:35
Does/Will avalonia support a coded ui kind of thing?
danwalmsley
@danwalmsley
May 18 2016 11:30
you can write the ui in code instead of xaml, is that what you mean?
Matthijs ter Woord
@mterwoord
May 18 2016 11:30
no
coded ui means controlling an application by code
used for testing
ie, it simulates clicks, keyboard input, etc, etc
danwalmsley
@danwalmsley
May 18 2016 11:31
well all the controls are unit testable without the xaml bit
Matthijs ter Woord
@mterwoord
May 18 2016 11:31
i want to test the xaml bit as well
ie, of my windows etc
that's wat coded ui/teststack white (open source alternative) lets you do
danwalmsley
@danwalmsley
May 18 2016 11:31
well if you follow Mvvm that is designed to allow that
I guess by unit testing your view models
Matthijs ter Woord
@mterwoord
May 18 2016 11:32
testing the viewmodel, but i also want to test the ui....
danwalmsley
@danwalmsley
May 18 2016 11:32
some of the other guys might offer better advice though
Matthijs ter Woord
@mterwoord
May 18 2016 11:32
:)
Steven Kirk
@grokys
May 18 2016 11:41
yeah, we'd need to support UI automation for that
which would also be needed for accesibility, e.g. for blind people
Matthijs ter Woord
@mterwoord
May 18 2016 11:42
ok, so pretty much, "planned, but not now or coming 2 year" ?
Steven Kirk
@grokys
May 18 2016 11:42
so it's something we should do, but not something on the immediate roadmap
well it pretty much depends on whether someone volunteers to do it
if it's me implementing in then then yeah: coming in 2 years ;)
Matthijs ter Woord
@mterwoord
May 18 2016 11:43
:)
Steven Kirk
@grokys
May 18 2016 11:44
i have no idea what's involved and we'd need an x-plat abstraction, so how hard it is depends on how similar the APIs are for different platforms i guess
Steven Kirk
@grokys
May 18 2016 12:12
@danwalmsley that's strange... have you committed? will try to take a look later
Darnell Williams
@Seeker1437
May 18 2016 14:53
@grokys can you send me a mention, trying to show someone the awesomeness of gitter.
Steven Kirk
@grokys
May 18 2016 15:31
@Seeker1437 like this?
Darnell Williams
@Seeker1437
May 18 2016 15:33
@grokys Yes, that was very helpful!
Thanks!
Steven Kirk
@grokys
May 18 2016 15:34
:D
danwalmsley
@danwalmsley
May 18 2016 17:03
@grokys will just do a commit to upgrade now...
VitalElement/AvalonStudio@0b78b3f
@grokys this commit shows updated Perspex. I'm sure its just an initialization order thing
Steven Kirk
@grokys
May 18 2016 17:12
thanks - got to go out soon but will try to take a look tomorrow
danwalmsley
@danwalmsley
May 18 2016 17:14
ok cheers
is there a way to not use the appbuilder?
Steven Kirk
@grokys
May 18 2016 17:15
sure, you can call the methods it calls
danwalmsley
@danwalmsley
May 18 2016 17:15
ok and that way it should be equivalent to before?
Steven Kirk
@grokys
May 18 2016 17:15
but you won't really be gaining much!
well no it should be equivalent to now, which should be equivalent to before!
danwalmsley
@danwalmsley
May 18 2016 17:16
if I do
var builder = AppBuilder.Configure<App>().UseWin32().UseDirect2D1().SetupWithoutStarting();
then it now displays and lays out correctly
but you cant click on anything
Steven Kirk
@grokys
May 18 2016 17:17
what did you do before?
danwalmsley
@danwalmsley
May 18 2016 17:17
nothing responds
this is my App class (inherits Application)
private static void Main(string[] args)
        {
            if (args == null)
            {
                throw new ArgumentNullException(nameof(args));
            }

            PackageSources.InitialisePackageSources();

            var container = CompositionRoot.CreateContainer();

            var builder = AppBuilder.Configure<App>().UseWin32().UseDirect2D1().SetupWithoutStarting();

            var commandService = container.GetExportedValue<ICommandService>();
            IoC.RegisterConstant(commandService, typeof(ICommandService));

            var keyGestureService = container.GetExportedValue<ICommandKeyGestureService>();
            IoC.RegisterConstant(keyGestureService, typeof(ICommandKeyGestureService));

            var toolBarBuilder = container.GetExportedValue<IToolBarBuilder>();
            IoC.RegisterConstant(toolBarBuilder, typeof(IToolBarBuilder));

            ShellViewModel.Instance = container.GetExportedValue<ShellViewModel>();

            builder.Start<MainWindow>();

            ShellViewModel.Instance.Cleanup();
        }

        public override void Initialize()
        {
            AvaloniaXamlLoader.Load(this);
        }
that is now
this is before
public App()
        {
            RegisterServices();
            this.UseWin32().UseDirect2D().LoadFromXaml();
        }

        private static void Main(string[] args)
        {
            if (args == null)
            {
                throw new ArgumentNullException(nameof(args));
            }

            PackageSources.InitialisePackageSources();

            var container = CompositionRoot.CreateContainer();
            var app = new App();

            var commandService = container.GetExportedValue<ICommandService>();
            IoC.RegisterConstant(commandService, typeof(ICommandService));

            var keyGestureService = container.GetExportedValue<ICommandKeyGestureService>();
            IoC.RegisterConstant(keyGestureService, typeof(ICommandKeyGestureService));

            var toolBarBuilder = container.GetExportedValue<IToolBarBuilder>();
            IoC.RegisterConstant(toolBarBuilder, typeof(IToolBarBuilder));

            ShellViewModel.Instance = container.GetExportedValue<ShellViewModel>();

            app.RunWithMainWindow<MainWindow>();

            ShellViewModel.Instance.Cleanup();
        }
the new one I didn't include app contructor because its now empty
its almost like main loop isn't even starting
danwalmsley
@danwalmsley
May 18 2016 17:25
ok I can do a workaround
builder.Instance.RunWithMainWindow<MainWindow>();
instead of
builder.Start<MainWindow>();
private static void Main(string[] args)
        {
            if (args == null)
            {
                throw new ArgumentNullException(nameof(args));
            }

            PackageSources.InitialisePackageSources();

            var container = CompositionRoot.CreateContainer();

            var builder = AppBuilder.Configure<App>().UseWin32().UseDirect2D1().SetupWithoutStarting();

            var commandService = container.GetExportedValue<ICommandService>();
            IoC.RegisterConstant(commandService, typeof(ICommandService));

            var keyGestureService = container.GetExportedValue<ICommandKeyGestureService>();
            IoC.RegisterConstant(keyGestureService, typeof(ICommandKeyGestureService));

            var toolBarBuilder = container.GetExportedValue<IToolBarBuilder>();
            IoC.RegisterConstant(toolBarBuilder, typeof(IToolBarBuilder));

            ShellViewModel.Instance = container.GetExportedValue<ShellViewModel>();

            builder.Instance.RunWithMainWindow<MainWindow>();

            ShellViewModel.Instance.Cleanup();
        }
Is the working code, seems using SetupWithoutStarting
then there is no way to prevent setup getting called twice
Steven Kirk
@grokys
May 18 2016 17:35
yeah you shouldn't call both Start and SetupWithoutStarting
sorry, got to run!
we can maybe make this better
danwalmsley
@danwalmsley
May 18 2016 17:37
thanks
by the way my popup problem is sorted now
thanks! :)
Steven Kirk
@grokys
May 18 2016 17:38
cool!
the outcome of it all was very strange
i wonder what caused the weird layout issues?
danwalmsley
@danwalmsley
May 18 2016 17:39
it might be that it didn't setup correct
and no viewmodel actually got assigned
and so some stuff wasn't hidden that should have
but it doesn't explain why my toolbar wasn't visible
and main menu was acting and looking wierd
Steven Kirk
@grokys
May 18 2016 17:40
yeah, very strange
anyway, got to go!
danwalmsley
@danwalmsley
May 18 2016 17:40
ok pal cheers for help
Steven Kirk
@grokys
May 18 2016 17:40
np!
danwalmsley
@danwalmsley
May 18 2016 21:50
woah! definitely found some obscure bug been introduces with itemscontrols
tried to add a simple drop down, as shown like this
image.png
<DropDown Items="{Binding IndexItems, Mode=TwoWay}" MinHeight="20" />
its bound to a list of strings...
but the above expected code produces this...
Jeremy Koritzinsky
@jkoritzinsky
May 18 2016 21:53
@wieslawsoltes @grokys I just sent in #538 which fixes hit testing and adorners to correctly calculate bounds for elements that have a RenderTransform.
danwalmsley
@danwalmsley
May 18 2016 21:53
image.png
instead of putting in labels for each string... it seems to put in some random controls from somewhere that cant be explained...
I can work around by doing...
<DropDown Items="{Binding IndexItems, Mode=TwoWay}" MinHeight="20">
          <DropDown.DataTemplates>
            <DataTemplate>
              <TextBlock Text="{Binding }" />
            </DataTemplate>
          </DropDown.DataTemplates>
        </DropDown>
@grokys you may want to see this
so something has happened recently with DataTemplates perhaps?
danwalmsley
@danwalmsley
May 18 2016 22:44
@wieslawsoltes where can I find your video showing memory leak on content control?
I'm going to try and create an issue for it
I saw that it may be related to styling system
danwalmsley
@danwalmsley
May 18 2016 22:58
guys who was working on Skia backend again, perhaps its time for me to try it out again?