These are chat archives for AvaloniaUI/Avalonia

1st
Jun 2018
Jumar Macato
@jmacato
Jun 01 2018 05:55
@Krutonium it should've been changed to http://avaloniaui.net/docs/quickstart/
where did you find that link?
Krutonium
@Krutonium
Jun 01 2018 05:56
Getting started link on the homepage
Jumar Macato
@jmacato
Jun 01 2018 05:57
right, just saw that. Thanks for reporting, i'll be posting a PR ASAP
Krutonium
@Krutonium
Jun 01 2018 05:57
:thumbsup:
Krutonium
@Krutonium
Jun 01 2018 06:16
None of the links in http://avaloniaui.net/docs/quickstart/ are working for me - they all time out
Steven Kirk
@grokys
Jun 01 2018 06:27
hmm that's strange @Krutonium
Krutonium
@Krutonium
Jun 01 2018 06:28
Like, the rest of the site loads fine
But anything in there... kaput
Steven Kirk
@grokys
Jun 01 2018 06:28
they're working ok here
so very strange you're just having problems with that section
Wiesław Šoltés
@wieslawsoltes
Jun 01 2018 06:32
Steven Kirk
@grokys
Jun 01 2018 06:32
yeah the diff feature is a great idea
Wiesław Šoltés
@wieslawsoltes
Jun 01 2018 06:32
and API docs
Krutonium
@Krutonium
Jun 01 2018 06:33
Aaand it randomly works now
Shakes Head
Steven Kirk
@grokys
Jun 01 2018 06:33
weird
Jumar Macato
@jmacato
Jun 01 2018 06:44
sir @grokys AvaloniaUI/avaloniaui.net#21
Steven Kirk
@grokys
Jun 01 2018 06:44
thanks!
just need to re-upload the site :/
wish it was automatic
Jumar Macato
@jmacato
Jun 01 2018 06:45
i think i saw some project that pulls a repo via webhooks to a webserver
i just can't remember the name
Krutonium
@Krutonium
Jun 01 2018 06:50
Q: What is the Avalonia equivalent to a Label?
Jumar Macato
@jmacato
Jun 01 2018 06:51
@Krutonium a TextBlock, for general purpose text display :)
Krutonium
@Krutonium
Jun 01 2018 06:52
Appreciated :)
danwalmsley
@danwalmsley
Jun 01 2018 10:37
@grokys I found a working unit test for the carousel issue
[Fact]
        public void Selected_Item_Changes_To_First_Item_When_Items_Property_Changes()
        {
            var items = new ObservableCollection<string>
            {
               "Foo",
               "Bar",
               "FooBar"
            };

            var target = new Carousel
            {
                Template = new FuncControlTemplate<Carousel>(CreateTemplate),
                Items =  items,
                IsVirtualized = false
            };

            target.ApplyTemplate();
            target.Presenter.ApplyTemplate();

            Assert.Single(target.GetLogicalChildren());

            var child = target.GetLogicalChildren().Single();

            Assert.IsType<TextBlock>(child);
            Assert.Equal("Foo", ((TextBlock)child).Text);

            var newItems = items.ToList();
            newItems.RemoveAt(0);

            target.Items = newItems;

            child = target.GetLogicalChildren().Single();

            Assert.IsType<TextBlock>(child);
            Assert.Equal("Bar", ((TextBlock)child).Text);
        }
it checks if the selected items becomes the first in the list of items if you change the items to a new list.
my fix resolves that
however, I'm wondering what happens if instead of completely replacing the Items with a new List
you remove the first item in the list
is that still a valid situation for carouselpresenter ? (i.e. I'm wondering if carousel does some handling of the Items list for us)
essentially I'm saying
If you have 3 items in carousel "Foo", "Bar" and "FooBar" and you remove "Foo"
should "Bar" automatically become selected?
or should the SelectedItem be null?
or do we leave it to the user to set the SelectedItem in this case?
Steven Kirk
@grokys
Jun 01 2018 10:57
yeah i think Bar should be selected
danwalmsley
@danwalmsley
Jun 01 2018 10:58
ok iv got a few tests to add but almost fixed
danwalmsley
@danwalmsley
Jun 01 2018 11:08
@grokys iv updated description of AvaloniaUI/Avalonia#1639 and added unit tests, if you get chance to review that would be great.
this bug has been plaguing me for years! I think I finally killed it off :)
actually i think i found another edge case
so don't merge just yet
ahopper
@ahopper
Jun 01 2018 11:27
if you remove everything from the collection and then add one, surely add needs to be handled?
danwalmsley
@danwalmsley
Jun 01 2018 11:30
that's handled currently
ahopper
@ahopper
Jun 01 2018 11:31
cool, must have missed some of the changes/conversation
danwalmsley
@danwalmsley
Jun 01 2018 11:34
well carousel is a weird one
the presenter only handles removing items in the collection changed handler
but the adding, etc gets handled by SelectingItemsControl
which is why at first glance it looks like adding isn't getting handled
ahopper
@ahopper
Jun 01 2018 11:39
a case of give with one hand and take away with the other :)
I'm spending a little time looking at the performance of applying styles, Is anyone else working on this?
danwalmsley
@danwalmsley
Jun 01 2018 11:44
i don't think anyone is doing that right now
lindexi
@lindexi
Jun 01 2018 11:44
yes
ahopper
@ahopper
Jun 01 2018 11:46
@lindexi hi, any progress or ideas ?
danwalmsley
@danwalmsley
Jun 01 2018 12:05
@grokys ok finally carousel is working and I have tests for each of the 3 bugs iv identified with it
in this test here
how would you have done that part to find first visual child that is textblock?
iv found 3 bugs with it and fixed them
1) if the bound items is changed, it makes a sensible selections (previously it would make selection null)
2) if an item is removed from beginning or end of list then the selection is maintained.
3) if selectedindex > 0 when template applied then this will be obeyed (currently you ended up with null)
lindexi
@lindexi
Jun 01 2018 12:28
@ahopper Sorry and I am watching the Windows Community Toolkit
danwalmsley
@danwalmsley
Jun 01 2018 14:18
@jkoritzinsky would you have time to review #1639 ?
Jeremy Koritzinsky
@jkoritzinsky
Jun 01 2018 14:25
Just did a review pass 👍
danwalmsley
@danwalmsley
Jun 01 2018 14:36
@jkoritzinsky how would you have done this part of the test?
Jeremy Koritzinsky
@jkoritzinsky
Jun 01 2018 14:39
Would GetVisualDecendants().Last() Work?
danwalmsley
@danwalmsley
Jun 01 2018 14:41
ok will try that :)
I'm still thinking of the virtualization thing
danwalmsley
@danwalmsley
Jun 01 2018 14:59
@jkoritzinsky ok iv added a test for when Virtualization = true and items is reset
could you check your happy with new test and code fix?
Jeremy Koritzinsky
@jkoritzinsky
Jun 01 2018 15:00
Approved!
danwalmsley
@danwalmsley
Jun 01 2018 15:01
@jkoritzinsky thanks
that's quite a few carousel bugs sorted
danwalmsley
@danwalmsley
Jun 01 2018 15:18
@jkoritzinsky @jkoritzinsky #1641 looks like .netcore 2.1 broke something for us
yikes :(
Jeremy Koritzinsky
@jkoritzinsky
Jun 01 2018 15:18
I'll take a look when I have time (hopefully later today).
danwalmsley
@danwalmsley
Jun 01 2018 15:21
ok
btw if all goes well msft are recommending people target 2.1 now since that will be the long term stable release
and if we make appveyor build using 2.1 our build times will speed up quite a bit
which will be nice