These are chat archives for AvaloniaUI/Avalonia

25th
Aug 2015
José Manuel Nieto
@SuperJMN
Aug 25 2015 00:46
OK! I've fixed the Bing Search demo
and I've fixed the issue with comments
Steven Kirk
@grokys
Aug 25 2015 00:48
awesome!
i'm working through the problems that xaml has shown up in perspex
the test app is more-or-less working now
you've updated the original PR? hmm... i'm not sure how to handle that
because in reality I've merged the original
it's just not marked as merged yet because it's still in a branch
José Manuel Nieto
@SuperJMN
Aug 25 2015 00:52
don't worry, I've made a new PR
it's a different one
Steven Kirk
@grokys
Aug 25 2015 00:52
ah ok great ;)
José Manuel Nieto
@SuperJMN
Aug 25 2015 00:53
if you cannot handle it, just kill it and I will try again when you're done!
the PR includes your reference fix (I've updated from you!)
so, the XamlTestApplication is better now?
Steven Kirk
@grokys
Aug 25 2015 00:54
ok, thanks, don't want to cause problems for you
yeah, if you try it from the xaml branch it's almost fully working now
the lists and animations pages are still a bit wonky
José Manuel Nieto
@SuperJMN
Aug 25 2015 00:55
I'll check right now!
Steven Kirk
@grokys
Aug 25 2015 00:56
I wanted to ask about Perspex.Xaml.Desktop.PerspexWindow - is that actually used?
José Manuel Nieto
@SuperJMN
Aug 25 2015 00:56
I omitted the Menus from the XAML because it made the app really glitchy.
Steven Kirk
@grokys
Aug 25 2015 00:56
sure
José Manuel Nieto
@SuperJMN
Aug 25 2015 00:57
It can be used, but the utility is almost none right now
Steven Kirk
@grokys
Aug 25 2015 00:57
yeah, i couldn't really see that point of it!
José Manuel Nieto
@SuperJMN
Aug 25 2015 00:57
it will have its utility
you can bet on it! :)
in the WPF counterpart, it's already abstracting how windows are shown
the system I designed is so powerful that you can make customize the creation of every object in the visual tree
providing IoC containers or whatever
ViewFactory is like a magic box
right now, Perspex requires to invoke Application.Current.Run(...) manually
so the utility of the viewFactory is not so evident there
José Manuel Nieto
@SuperJMN
Aug 25 2015 01:03
for instance, in the WPF demo application for OmniXAML I have:

namespace SampleWpfApp
{
using System.Windows;
using OmniXaml.Wpf;

/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
    protected override void OnStartup(StartupEventArgs e)
    {
        base.OnStartup(e);

        var viewFactory = new WpfViewFactory();
        viewFactory.Show("Main");
    }
}    

}

that single line locates the Window identified by the token "Main", and automatically injects, by naming convention, its ViewModel
and shows it
In Perspex it's not possible to use the same code since there is no OnStartup method
it would be nice to have!
I asked a question in Stack Overflow about how WPF handles the creation of windows during the startup of an application. This is what they answered:
José Manuel Nieto
@SuperJMN
Aug 25 2015 01:08
it seems that after the call to OnStartup, if a Window is shown, it will use it as its Current Window and it will automatically invoke Run( ) on it
(therefore, waiting for it to be close before shutting down)
Steven Kirk
@grokys
Aug 25 2015 01:12
ok... i'm not sure what you're trying to do precisely but it sounds like this is all higher level stuff right?
is this all related to MVVM?
like the [ViewToken("Main", typeof(MainWindow))] stuff - that all looks MVVM-related
José Manuel Nieto
@SuperJMN
Aug 25 2015 01:15
yes, it's higher level
MVVM stuff
too handy to be ignored
Steven Kirk
@grokys
Aug 25 2015 01:16
yeah, my feeling is that probably shouldn't be coupled to the XAML stuff so tightly
as it'd be nice for other people to be able to write their own MVVM libs etc as in WPF
José Manuel Nieto
@SuperJMN
Aug 25 2015 01:17
You're right! but at the moment it's so small that I decided that it's not worth a new project
Steven Kirk
@grokys
Aug 25 2015 01:17
sure
José Manuel Nieto
@SuperJMN
Aug 25 2015 01:17
at least, at the moment, but we'll separate later on
yes, people could use their own MVVM frameworks!
Steven Kirk
@grokys
Aug 25 2015 01:18
does the Window currently have to implement OmniXaml.AppServices.Mvvm.IView? i tried to make MainWindow inherit just from Window instead of PerspexWindow but it seems that the XAML loader requires IView
José Manuel Nieto
@SuperJMN
Aug 25 2015 01:18
but at the moment, it has a "default" one
no, it doesn't require it to be an IView
the factory requires it, but the loader doesn't :)
Steven Kirk
@grokys
Aug 25 2015 01:20
ok great ;)
José Manuel Nieto
@SuperJMN
Aug 25 2015 01:20
it's super dettached!
Steven Kirk
@grokys
Aug 25 2015 01:20
yeah, i notice the OmniXaml MVVM stuff is in a different lib
if i wanted to load the window contents from a xaml file but not use the MVVM stuff, how would I do it?
José Manuel Nieto
@SuperJMN
Aug 25 2015 01:22
It's likely to grow
you currently could do it with this
        var loader = new PerspexXamlLoader(new PerspexInflatableTypeFactory());
        loader.Load(stream);
Steven Kirk
@grokys
Aug 25 2015 01:23
ah - easy ;)
José Manuel Nieto
@SuperJMN
Aug 25 2015 01:24
the InflatableTypeFactory is a factory that will inflate the types if they are inflatable
Steven Kirk
@grokys
Aug 25 2015 01:24
what is an "inflatable" type?
José Manuel Nieto
@SuperJMN
Aug 25 2015 01:24
UserControls
Windows
Pages
Steven Kirk
@grokys
Aug 25 2015 01:24
so like the root views
José Manuel Nieto
@SuperJMN
Aug 25 2015 01:24
everything that can be hydrated from XAML as a root
yes, but it's interesting
because if you have a Window with a UserControl inside... then the inflatablefactory will try to inflate the UserControl by convention
when it finds the UserControl named "MyUserControl", it will try to locate MyUserControl.xaml"
and it will use it
I could do it even easier making the PerspexXamlLeader parameterless
Hey, I'm going to bed!
Steven Kirk
@grokys
Aug 25 2015 01:27
ok, sure - i'll keep looking around
looking good so far!
just a bit hard to understand how it all fits together without any docs ;)
José Manuel Nieto
@SuperJMN
Aug 25 2015 01:28
yes, it looks GREAT! I've seen your fixes. Niiiiceee!
Steven Kirk
@grokys
Aug 25 2015 01:28
but i understand - that comes later
José Manuel Nieto
@SuperJMN
Aug 25 2015 01:28
OK! some docs have to come!
see you tomorrow :D
Steven Kirk
@grokys
Aug 25 2015 01:29
i'm thinking that i might get rid of the test apps and build a catalog like in polymer: https://elements.polymer-project.org/
ok tomorrow!
José Manuel Nieto
@SuperJMN
Aug 25 2015 01:29

i'm thinking that i might get rid of the test apps and build a catalog like in polymer: https://elements.polymer-project.org/

10 out of 10!

that would be very useful!
Steven Kirk
@grokys
Aug 25 2015 01:29
yeah
RichiCoder1 @RichiCoder1 thinks ya'll guys are awesome.
RichiCoder1 @RichiCoder1 leaves again.
José Manuel Nieto
@SuperJMN
Aug 25 2015 10:04
hahaha @RichiCoder1!
Steven Kirk
@grokys
Aug 25 2015 10:40
@SuperJMN currently you can't do <TextBlock>Foo</TextBlock> - what would be required to allow that? i thought i could start with something simple ;)
Steven Kirk
@grokys
Aug 25 2015 10:46
grokys/Perspex#79
José Manuel Nieto
@SuperJMN
Aug 25 2015 10:48
Hey!! cool finding!
it's an easy one :D
are you there?
Steven Kirk
@grokys
Aug 25 2015 10:49
yes
José Manuel Nieto
@SuperJMN
Aug 25 2015 10:49
OK :) Locate PerspexWiringContext
under the method: GetContentPropertyProvider
add this "new ContentPropertyDefinition(typeof (TextBlock), "Text"),"
OK, I've tried it. It doesn't produce the error, but the Text isn't there :S
Steven Kirk
@grokys
Aug 25 2015 10:52
yep, same for me ;)
really easy to do though!
i'm going to merge the xaml branch to master anyway
it's close enough to all working
José Manuel Nieto
@SuperJMN
Aug 25 2015 10:54
OK! I'll fix the bug you've just found
I will have it working ASAP
Steven Kirk
@grokys
Aug 25 2015 10:57
github seems to be undergoing a DDOS so i can't yet push to master :shit:
José Manuel Nieto
@SuperJMN
Aug 25 2015 11:08
DDOS against GitHub? God why?!
Steven Kirk
@grokys
Aug 25 2015 11:08
idiots everywhere
José Manuel Nieto
@SuperJMN
Aug 25 2015 11:35
idiots everywhere
:+1:
Instead of helping the community to do great things, they try to fuck them down
pretty reasonable, uh?
José Manuel Nieto
@SuperJMN
Aug 25 2015 12:39
OK, the bug you discovered is fixed! (presumably)
SuperJMN/OmniXAML#16
It's solved in the new version (Nuget Packages 1.4.4.0)
Steven Kirk
@grokys
Aug 25 2015 12:41
ok, great, will update and try shortly
Steven Kirk
@grokys
Aug 25 2015 13:10
what is OmniXaml.AppServices.NetCore do? does OmniXaml include networking code?
Steven Kirk
@grokys
Aug 25 2015 13:59
hmm, it seems to be assembly-based stuff. what does Net relate to? Or is this code for .net core? i think maybe the name is a bit confusing/misleading
José Manuel Nieto
@SuperJMN
Aug 25 2015 13:59
Hey! Sorry, was away! It's Code specific to the full NET. I don't know which name is the best!
Steven Kirk
@grokys
Aug 25 2015 13:59
probably DotNet would be better?
.net core is the new version of .net
José Manuel Nieto
@SuperJMN
Aug 25 2015 14:00
It's for the full .NET libs
Steven Kirk
@grokys
Aug 25 2015 14:00
ok, i believe that is referred to as the .net framework
José Manuel Nieto
@SuperJMN
Aug 25 2015 14:00
.Desktop?
Steven Kirk
@grokys
Aug 25 2015 14:00
DotNetFx maybe?
José Manuel Nieto
@SuperJMN
Aug 25 2015 14:00
I have to find a good name
That sounds better
Steven Kirk
@grokys
Aug 25 2015 14:01
yeah, not a big issue - i was just left wondering
José Manuel Nieto
@SuperJMN
Aug 25 2015 14:01
I'll have to rename it, yes
Steven Kirk
@grokys
Aug 25 2015 14:01
i guess it'd be useful to know if it does work on .net core too
José Manuel Nieto
@SuperJMN
Aug 25 2015 14:02
By the way, cool that you've found a new issue!
Steven Kirk
@grokys
Aug 25 2015 14:02
:)
the issues will start rolling in ;)
José Manuel Nieto
@SuperJMN
Aug 25 2015 14:02
Avalanche!
José Manuel Nieto
@SuperJMN
Aug 25 2015 14:19
I've just posted a question in Stack Overflow asking for some standar suffix for .NET Framework specific assemblies
It will be funny to read the answers!
José Manuel Nieto
@SuperJMN
Aug 25 2015 15:28
@grokys try this XAML when you have time :)
This message was deleted
whoops, it's huge for a message :S better if I create a Gist
Steven Kirk
@grokys
Aug 25 2015 15:57
adds a Menu to the test app?
José Manuel Nieto
@SuperJMN
Aug 25 2015 16:05
And the TreeView
Just for saving time if you wanted to test something
Steven Kirk
@grokys
Aug 25 2015 16:06
ah ok, sure - will update that after i've finished this bit of work
José Manuel Nieto
@SuperJMN
Aug 25 2015 16:06
It's more similar to the non-XAML app 😊
Nice!!
What are you doing now?
Steven Kirk
@grokys
Aug 25 2015 16:06
work work ;) i.e. my job
next i want to fix these issues to get to alpha
grokys/Perspex#79
if you wanted to do more work on the xaml test app to make it the same as the non-xaml one you're welcome ;0
José Manuel Nieto
@SuperJMN
Aug 25 2015 16:13
Earning money! High priority 😁
Richard Simpson
@RichiCoder1
Aug 25 2015 18:58
@SuperJMN based on the monikers here, I'd say either net or netfx
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:11

@SuperJMN based on the monikers here, I'd say either net or netfx

Wow, nice finding! Thank you! I think I will adopt it

by the way, just to tell you, I'm having a hard time with XAML namescopes
I'm very confused about how they work!
Steven Kirk
@grokys
Aug 25 2015 21:12
i think perspex will implement namescopes independent of xaml
currently in WPF if you add a control with a name outside XAML it doesn't get added to a namescope!
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:13
It's a bit of a mess!
I have to fully understand what's going on to implement something like that
Steven Kirk
@grokys
Aug 25 2015 21:14
basically from what i understand: if an object in a XAML file imeplemts INameScope then children with a Name property are registered with it
however
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:15
and what's the utility of that? :)
Steven Kirk
@grokys
Aug 25 2015 21:15
you can also make any element a namescope by setting the NameScope attached property
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:15
a parent with a list of names?
Steven Kirk
@grokys
Aug 25 2015 21:16
it's so you can find a control by name
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:16
uhmm
button.FindName(childName)?
Steven Kirk
@grokys
Aug 25 2015 21:16
exactly
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:16
O_O
Steven Kirk
@grokys
Aug 25 2015 21:16
or more likely, window.FindName(controlName)
which is what WPF does in InitializeControl to set the Window control fields
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:17
I freak out
haha
Steven Kirk
@grokys
Aug 25 2015 21:17
to me it pretty much makes sense
except for the fact that it only works from XAML!
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:18
so... it's similar to what name scopes do in code?
Steven Kirk
@grokys
Aug 25 2015 21:18
imagine when you create a window, and you have a <Button Name="btn"> in your XAML
you need to find that control and assign it to MyWindow.btn
you could either search the entire tree for each control you want to find
or you could do a name lookup using the namescope
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:20
nice, but... it's a bit dirty to do something like 'if x is INameScope"
haha
Steven Kirk
@grokys
Aug 25 2015 21:20
why?
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:21
I don't know, it feels tricky :)
but yes, it's just like IMarkupExtensions!
Steven Kirk
@grokys
Aug 25 2015 21:21
no, afaics it's the best way to do it
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:21
yes, you're right...!
OK, I have to think about it
and perform some tests
Steven Kirk
@grokys
Aug 25 2015 21:22
you can't just have a single name scope because e.g. in the template for a control there will often be named controls
they will be repeated for every instance of that control
so a templated control has a namescope
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:22
so... I think a Window should keep a list of children
Steven Kirk
@grokys
Aug 25 2015 21:22
yes, a Window is a namescope
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:23
is a TextBlock a namescope?
every FrameworkElement?
Steven Kirk
@grokys
Aug 25 2015 21:23
no, because that's not a templated control
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:25
yay! I'll bookmark that :) thank you!
oh, it says this "FrameworkElement also has FindName, RegisterName and UnregisterName methods."
so FrameworkElement is a namescope, I guess
Steven Kirk
@grokys
Aug 25 2015 21:27
no - read the next part
if the element owns a name scope, the element methods simply call into the name scope's methods. Otherwise, WPF walks up the (logical) tree looking for the nearest namescope.
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:30
I alluded to the similarity between xaml and C# namescopes -- one important difference is that in xaml, namescopes don't nest -- if WPF doesn't find the name you're looking for in the first name scope, it doesn't go out to a bigger name scope. But that's a post for another day...
Steven Kirk
@grokys
Aug 25 2015 21:31
yes, if you're looking for a control called "button" in a UserControl, you don't want it to find a control named "button" in the containing Window!
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:31
OK!
so it won't go up
I still have doubts, though
a Window is a namescope
but a Button isn't
a DataTemplate is a namescope
Steven Kirk
@grokys
Aug 25 2015 21:33
a button contains a namescope
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:33
where?
Steven Kirk
@grokys
Aug 25 2015 21:33
a button is a templated control
imagine that the template for a button looks like this
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:33
a Windows is, too
a UserControl, too
Steven Kirk
@grokys
Aug 25 2015 21:33
yes, and they're all name scopes
imagine that the template for a button looks like this:
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:33
OK
Steven Kirk
@grokys
Aug 25 2015 21:34
<Border><TextBlock Name="tb" Text="{TemplateBinding Content"/></Border>
that's saying "everytime the user instantiates a button, create a border and a textblock
now suppose that from the Button code you need to get hold of the TextBlock
for every button in the app, there is going to be a TextBlock named tb
but you want the one in the current button
the controls created by the Button template get put in their own namescope
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:37
but what's that namescope?
Steven Kirk
@grokys
Aug 25 2015 21:37
so each Button has a tb
the namescope will be the Border i believe
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:37
is it a declaration like class Button : INameScope?
Steven Kirk
@grokys
Aug 25 2015 21:38
no, the Border is made a namescope by setting the NameScope attached property
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:38
O_O
oh my...
I haven't seen that in my whole WPF life
Steven Kirk
@grokys
Aug 25 2015 21:39
you probably wouldn't - it's a pretty low level thing
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:39
I'll have to think about how to design the whole shit
I hope it's not so complex :)!
Steven Kirk
@grokys
Aug 25 2015 21:40
i don't think it will be
but it's something i've still not implemented in perspex
for the moment i search the tree each time i lookup a control
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:40
OK
it's not a priority, then?
Steven Kirk
@grokys
Aug 25 2015 21:41
it's something i hope to implement soon
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:41
anyways, I will take a look to figure out
I'm going to bed early tonight :)
Steven Kirk
@grokys
Aug 25 2015 21:41
yeah, i'm unsure of the interactions between the xaml idea of namescopes and the wpf implementation
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:41
by the way, I've seen your changes and it looks very good so far!
Steven Kirk
@grokys
Aug 25 2015 21:42
not done much yet - been trying to get stuff working on mono but no luck so far
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:43
Mono is a little crazy monkey... for sure
See you tomorrow!
Steven Kirk
@grokys
Aug 25 2015 21:43
:monkey:
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:44
leaving for the moment !
Steven Kirk
@grokys
Aug 25 2015 21:44
tomorrow!
José Manuel Nieto
@SuperJMN
Aug 25 2015 21:44
haha, see you!!