These are chat archives for AvaloniaUI/Avalonia

24th
Aug 2015
Steven Kirk
@grokys
Aug 24 2015 09:19
so it would make more sense for ItemsControl.Items to be of type ICollection?
José Manuel Nieto
@SuperJMN
Aug 24 2015 10:05
Sorry! I have checked the change I did before and I just added the defaultValue.
So it's IEnumerable.
Yesterday I didn't have time to fix the problem. I will tell you later. I'm doing the house 😋
Steven Kirk
@grokys
Aug 24 2015 10:06
hmm, i don't think it's a good idea for a defaultValue to be a new-able object like that
i think it will reallocate a new list each time the property is read
deafult values are currently intended to be for simple value types
wouldn't it make more sense that if you try to assign a collection to an IEnumerable property it creates a List?
Steven Kirk
@grokys
Aug 24 2015 10:19
ItemsSource in WPF doesn't have a defaul value
actually it won't reallocate each time, instead the same list will be shared by all instances! not good
José Manuel Nieto
@SuperJMN
Aug 24 2015 10:22
It has to be completely initialized before XAML can add items
Steven Kirk
@grokys
Aug 24 2015 10:23
so you can't assign to ItemsSource in WPF from XAML?
José Manuel Nieto
@SuperJMN
Aug 24 2015 10:23
Being and interface, the parser couldn't decide which implementation to choose.
It just gets the already existing instance and works with it
I copied the behavior of WPF
Steven Kirk
@grokys
Aug 24 2015 10:27
right... ok, the difference being that WPF has an Items property which is already initialized and an ItemsSource property which is more like what we have in Perspex
i don't like the duplication that you have in WPF - it always seemed strange to me to have two properties that did the same thing
for the moment, the solution is to create a collection in the ItemsControl constructor rather than using defaultValue
This message was deleted
José Manuel Nieto
@SuperJMN
Aug 24 2015 11:02
What properties are you referring to? I don't understand
Steven Kirk
@grokys
Aug 24 2015 11:14
for the Items property: instead of setting its defaultValue in the property registration - which will cause all instances to share the same collection - assign the collection to the property in the constructor
José Manuel Nieto
@SuperJMN
Aug 24 2015 11:52
It makes sense :D
I will see if it works
it should...!
argh, it doesn't :S
    /// <summary>
    /// Initializes a new instance of the <see cref="ItemsControl"/> class.
    /// </summary>
    public ItemsControl()
    {
        this.Classes.Add(":empty");
        this.Items = new Collection<object>();
    }
with that, the window appears empty
Steven Kirk
@grokys
Aug 24 2015 11:57
you should probably use a collection that implements INotifyCollectionChanged, i.e. PerspexList
otherwise the control doesn't know when you add stuff to it!
José Manuel Nieto
@SuperJMN
Aug 24 2015 11:58
aha! OK
thank you!
I'm still fixing things
Steven Kirk
@grokys
Aug 24 2015 12:01
no problem!
there's no hurry
José Manuel Nieto
@SuperJMN
Aug 24 2015 12:10
OK, it doesn't work
maybe the best thing I can do is just send the pull request
and later, we can work in solving that
I've got it working already
Steven Kirk
@grokys
Aug 24 2015 12:11
sure
José Manuel Nieto
@SuperJMN
Aug 24 2015 12:11
that way, you can already see what's going on
I notice there are several UI problems with the latest version
you will see it for yourself
Steven Kirk
@grokys
Aug 24 2015 12:12
ok
José Manuel Nieto
@SuperJMN
Aug 24 2015 12:12
anyways, the XAML thingy is working!
and a Window with tabs is showing
inspect it when you have some time :D
I'm about to pull request
José Manuel Nieto
@SuperJMN
Aug 24 2015 12:26
I think it's done!
Steven Kirk
@grokys
Aug 24 2015 12:35
ok, great! i will take a look this afternoon/evening after work and hopefully merge
Steven Kirk
@grokys
Aug 24 2015 17:16
added a comment to the PR
i've fixed it here locally and seems to work
do you want me to just merge with my fix or do you want to fix it in your branch?
Steven Kirk
@grokys
Aug 24 2015 17:24
never mind, i'll commit the fix
anyway, kinda works! i've merged into xaml branch while i try to fix the problem you mentioned earlier
José Manuel Nieto
@SuperJMN
Aug 24 2015 18:32
Wow! Sounds great! I'll check later when I'm home.
Sorry, I've been away
Steven Kirk
@grokys
Aug 24 2015 18:33
no problem - i've already logged a OmniXaml bug ;)
José Manuel Nieto
@SuperJMN
Aug 24 2015 18:35
Hahaha SuperJMN/OmniXAML#9
Thanks! But now I have to learn how to merge issues :smile:
Steven Kirk
@grokys
Aug 24 2015 18:36
ahhh, sorry, i didn't do a search. i will mark mine as duplicate and close
José Manuel Nieto
@SuperJMN
Aug 24 2015 18:36
Butttt, your comment is useful!
Steven Kirk
@grokys
Aug 24 2015 18:36
well it's still there, just closed ;)
José Manuel Nieto
@SuperJMN
Aug 24 2015 18:36
Don't throw it
OK!
Steven Kirk
@grokys
Aug 24 2015 18:37
#9 links to it
José Manuel Nieto
@SuperJMN
Aug 24 2015 18:37
Thank you man!
Steven Kirk
@grokys
Aug 24 2015 18:37
;)
just trying to fix the various problems that your XAML stuff has shown up in Perspex
José Manuel Nieto
@SuperJMN
Aug 24 2015 18:39
Ask me whatever!
This message was deleted
Any question or problem, just tell me
It should read almost any XAML
Steven Kirk
@grokys
Aug 24 2015 18:44
sure, the problem seems to be with Perspex though
José Manuel Nieto
@SuperJMN
Aug 24 2015 18:44
Argh, it seems there are some bad assembly references. I've just seen your comment on the PR
Steven Kirk
@grokys
Aug 24 2015 18:44
yeah, it's ok, i fixed them on the perspex xaml branch, don't worry about it
José Manuel Nieto
@SuperJMN
Aug 24 2015 18:44
Cool!
Glass is there in Nuget.org
Should work
Steven Kirk
@grokys
Aug 24 2015 18:45
yeah, i was wondering what Glass was?
José Manuel Nieto
@SuperJMN
Aug 24 2015 18:45
A support/aux lib
Steven Kirk
@grokys
Aug 24 2015 18:46
yeah i thought so - seems a bit of a shame to use such a good name for such a small lib though!
;)
José Manuel Nieto
@SuperJMN
Aug 24 2015 18:46
For OmniXAML. It provides pretty common functionalities!

yeah i thought so - seems a bit of a shame to use such a good name for such a small lib though!

It's the name of a bigger lib I created in the past :smiley:

Steven Kirk
@grokys
Aug 24 2015 18:48
i bet you're going to have someone cursing you for using that name for an aux lib ;)
José Manuel Nieto
@SuperJMN
Aug 24 2015 18:49
Haha, probably! But it may grow in the future
I have the fully fledged lib in my VS Online repo
Waiting to see the light :relieved:
There was a Glass.Design lib for creating visual designers