These are chat archives for AvaloniaUI/Avalonia

16th
Jun 2015
Steven Kirk
@grokys
Jun 16 2015 11:49 UTC
sure, i'll take a look if you prepare a branch for me
José Manuel Nieto
@SuperJMN
Jun 16 2015 19:35 UTC
Hello! I've been out today
@grokys Thank you! I've prepared the branch. Just clone this: https://github.com/SuperJMN/Perspex-OmniXAMLed.git
And check out the branch named "TreeView" (the one I prepared with the failing scenario)
If you run the classic TestApplication, you will see that it contains only a TreeView with an item
it loads perfectly
but if you run XamlTestApplication (I have separated both test apps), you will see that it throws an exception
inside the XAML tester you will see a Views folder with 3 XAML files. The one that is loaded during the test is "PerspexWindow-Full.xaml"
You will soon notice that is doesn't contain much! in fact, it contains the same composition as before (Window with TreeView with one Item)
Steven Kirk
@grokys
Jun 16 2015 20:06 UTC
ok, thanks! it will probably be at least tomorrow before i can take a look
but i'm sure it'll be something simple
José Manuel Nieto
@SuperJMN
Jun 16 2015 20:22 UTC
for sure!
something that depends on order
by the way, I modified the Items property in ItemsControl
I added a default value
since it's IEnumerable, the object assembler cannot instantiate it (it's an interface) so the default value is a Collection<object>
WPF also does this
Steven Kirk
@grokys
Jun 16 2015 20:25 UTC
ah really? ok
José Manuel Nieto
@SuperJMN
Jun 16 2015 20:25 UTC
if the object in the XAML has a collection, it requires to have it ready
fore example, this doesn't inflate!
Steven Kirk
@grokys
Jun 16 2015 20:26 UTC
ah really?
José Manuel Nieto
@SuperJMN
Jun 16 2015 20:27 UTC
this doesn't inflate:
class Sample 
{
       public IEnumerable<Collection> Children {get; set; }
}
this DOES work:
Steven Kirk
@grokys
Jun 16 2015 20:28 UTC
i was actually thinking of changing the type of Items to be an ICollection
José Manuel Nieto
@SuperJMN
Jun 16 2015 20:28 UTC
class Sample 
{
       Sample()
       {
               Children = new List<object>();
       }
       public IEnumerable<Collection> Children {get; set; }
}
Steven Kirk
@grokys
Jun 16 2015 20:28 UTC
yeah, that makes sense i guess
José Manuel Nieto
@SuperJMN
Jun 16 2015 20:29 UTC
since it's just an interface, it cannot choose which implementation
it just knows that it will use it, and add items
Steven Kirk
@grokys
Jun 16 2015 20:29 UTC
sure, though probably it could just choose one (probably List<T>)
José Manuel Nieto
@SuperJMN
Jun 16 2015 20:29 UTC
(via casting and tricky stuff)
Steven Kirk
@grokys
Jun 16 2015 20:30 UTC
but i understand you want to follow what System.Xaml does
José Manuel Nieto
@SuperJMN
Jun 16 2015 20:30 UTC
haha, that is an option !
yes, I didn't want to put the loader the responsibility to choose which implementation to use
it's a bit silly in that aspect
:)
so, when you try the code, keep in mind that I did that change in my fork
the rest is unchanged
ah! also DataTemplate has a default constructor
but that doesn't affect, I suppose :)
Steven Kirk
@grokys
Jun 16 2015 20:35 UTC
yeah that should all be ok!
thanks!