These are chat archives for AvaloniaUI/Avalonia

11th
Nov 2016
Jeremy Koritzinsky
@jkoritzinsky
Nov 11 2016 00:02
I've been reviewing the code as it comes in. Looks good so far!
danwalmsley
@danwalmsley
Nov 11 2016 00:02
@grokys with memory leak I have this....
image.png
I remember once I showed you something similar and you said straight away what it was...
does that mean anything to you?
being stuck with something in style_applied
Steven Kirk
@grokys
Nov 11 2016 00:07
yeah, a style is being applied to a control, but the control isn't being removed from the logical tree, so the style isn't being unapplied
in Avalonia.Styling.Style._applied
danwalmsley
@danwalmsley
Nov 11 2016 00:09
see just you saying that I realise exactly what I need to do to fix it ;)
thanks
Jeremy Koritzinsky
@jkoritzinsky
Nov 11 2016 00:13
Btw just want to let you guys know that I'm working on an AppKit based windowing subsystem and (soon) a Quartz based rendering system for OSX app store apps and iOS.
Steven Kirk
@grokys
Nov 11 2016 00:18
oh wow cool!
Jeremy Koritzinsky
@jkoritzinsky
Nov 11 2016 00:20
Yeah! It will be really nice for iOS since we can allow users to not need to include Skia in their iOS apps (and keep the size down a little)
I will have to do some eventual refactoring in the iOS code though to factor out the SkiaSharp dependencies
Steven Kirk
@grokys
Nov 11 2016 00:24
hopefully running on iOS should be viable with the dirty rect stuff
as i understand it was really slow before
Jeremy Koritzinsky
@jkoritzinsky
Nov 11 2016 00:35
I still havent gotten a chance to really mess with iOS. I think some of the build might be broken right now. I'll send in a PR soon if that is the case.
Steven Kirk
@grokys
Nov 11 2016 00:40
yeah i think iOS and android are currently broken
Jeremy Koritzinsky
@jkoritzinsky
Nov 11 2016 00:48
I just thought of something we could ask for from the .net foundation
Xamarin Test Cloud license
Would allow us to do legit CI tests on iOS and Android
Steven Kirk
@grokys
Nov 11 2016 00:48
yes, definitely!
danwalmsley
@danwalmsley
Nov 11 2016 16:44
@grokys i definitely need to fix the carousel problem!
its proving much harder than I though....
my fix I thought could be here...
so I changed it to
protected virtual void OnContainersMaterialized(ItemContainerEventArgs e)
        {
            var toAdd = new List<ILogical>();

            foreach (var container in e.Containers)
            {
                // If the item is its own container, then it will be added to the logical tree when
                // it was added to the Items collection.
                if (container.ContainerControl != null && container.ContainerControl != container.Item)
                {
                    toAdd.Add((container.ContainerControl as ContentPresenter).Content as ILogical);
                }
            }

            LogicalChildren.AddRange(toAdd);
        }
but
container.ContainerControl as ContentPresenter).Content is "Foo" as a string
and
container.ContainerControl as ContentPresenter).Child is null
so I don't have a way to find the textbox
and I cant call updateChild on ContentPresenter :(
Darnell Williams
@Seeker1437
Nov 11 2016 16:46
WHy not?
danwalmsley
@danwalmsley
Nov 11 2016 16:46
so not sure how to get the child so it can be added to logical children
UpdateChild is a member of ContentControl
not ContentPresenter ;)
Darnell Williams
@Seeker1437
Nov 11 2016 16:47
It's a member of ContentPresenter I thought :O??
danwalmsley
@danwalmsley
Nov 11 2016 16:47
now ContentControl as far as I can tell!
Darnell Williams
@Seeker1437
Nov 11 2016 16:49
Its is possible to use the instance and search for it's template parts using it's namescope?
danwalmsley
@danwalmsley
Nov 11 2016 16:56
@grokys also here, at least under the test, there are no data templates for strings...
so
protected virtual IControl CreateContainer(object item)
        {
            var result = item as IControl;

            if (result == null)
            {
                result = new ContentPresenter();
                result.SetValue(ContentPresenter.ContentProperty, item, BindingPriority.Style);

                if (ItemTemplate != null)
                {
                    result.SetValue(
                        ContentPresenter.ContentTemplateProperty,
                        ItemTemplate,
                        BindingPriority.TemplatedParent);
                }
            }

            return result;
        }
ItemTemplate == null
perhaps this is why my code doesn't work yet, is this because its a unit test
?
danwalmsley
@danwalmsley
Nov 11 2016 17:12
@grokys I hope we can get this carousel fix in before next release ;)
Steven Kirk
@grokys
Nov 11 2016 17:32
UpdateChild is a member of ContentControl
there's no UpdateChild in ContentControl
also here, at least under the test, there are no data templates for strings...
if there's no data template, ToString() is called on the data object and put into a TextBlock just like in WPF
Steven Kirk
@grokys
Nov 11 2016 17:40
but yes i think the solution you posted is the correct one - you just need to call UpdateChild as you thought you did!
danwalmsley
@danwalmsley
Nov 11 2016 18:16
Hmm gonna have to check, but update child wasn't showing up in IntelliSense
Probably a brain fart!
Darnell Williams
@Seeker1437
Nov 11 2016 18:59
Its what we call inside branch when we listen for changes in visibility ;)
danwalmsley
@danwalmsley
Nov 11 2016 20:14
ok so that was easy
just to see what it breaks!
it breaks 39 unit tests!
@grokys
what should this behaviour be now?
danwalmsley
@danwalmsley
Nov 11 2016 20:30
@grokys was this...
the right thing to do,
when its a listbox, its not a contentpresenter, but a listbox item so id need to have a special case for that one...?
Steven Kirk
@grokys
Nov 11 2016 20:32
yeah you need to detect somehow if it's coming from a typed ItemContainerGenerator probably?
danwalmsley
@danwalmsley
Nov 11 2016 20:33
in that case, I don't need to change the behaviour?
&& ItemContainerGenerator == null?
or we always have one of those...
something like....
if (ItemContainerGenerator is ItemContainerGenerator)
                    {
                        (container.ContainerControl as ContentPresenter).UpdateChild();
                        toAdd.Add((container.ContainerControl as ContentPresenter).Child as ILogical);
                    }
                    else
                    {
                                // Do what we were doing before???
Steven Kirk
@grokys
Nov 11 2016 20:43
maybe add a member to IItemContainerGenerator something like Type ContainerType { get; } and if it returns null it's an untyped container generator
danwalmsley
@danwalmsley
Nov 11 2016 20:44
ok aweseome
Should it be called better ContainerGeneratorType?
Steven Kirk
@grokys
Nov 11 2016 20:57
i'd say ContainerType as it represents the type of container that the generator generates
ContainerGeneratorType to me suggests the type of the generator
danwalmsley
@danwalmsley
Nov 11 2016 20:59
ok
makes sense... it was thinking we were checking if the ContainerGenerator was a generic version... but
what you are saying makes way more sense.
ok only 3 failing tests now..
I cant see why its parent should be null? why did we want this behaviour?
danwalmsley
@danwalmsley
Nov 11 2016 21:17
@grokys the other test that is broken is
tabcontrol...
my changes have stopped DataTemplates being applied, any idea what I need to be looking at?
danwalmsley
@danwalmsley
Nov 11 2016 21:33
@grokys ok going away for a bit, but if your back later and have time to have a quick look at #799 I can come back and finish it off, just ping me a message
:)
danwalmsley
@danwalmsley
Nov 11 2016 23:21
anyone know how to control how wide a tab char '\t' renders? seems to be equivalent of 8 spaces in formattedtext implementation
on direct2d
anyone come across this?