These are chat archives for AvaloniaUI/Avalonia

18th
Mar 2016
Darnell Williams
@Seeker1437
Mar 18 2016 00:00
THe toher thing about it is that there or different kinds of organizers one might apply by choice which would change the overall behavior
Steven Kirk
@grokys
Mar 18 2016 00:00
well you're lucky there in that Perspex's layout system is almost identical to WPF so any documentation on that should apply: https://msdn.microsoft.com/library/ms745058(v=vs.100).aspx
what different layouts might there be?
it looks like you're kind of reimplementing perspex's layout system, which could be a valid solution, but you may find it easier to make use of what's already there and extend it by implementing your own Panel
Darnell Williams
@Seeker1437
Mar 18 2016 00:04
well extending StackOrganizer there are Horizontal or Vertical implementations and then Organizing by the Canvas size (responsive)
THe user would also have the freedom of implementing their own too
okay so using MeasureOverride would do better in this instance
Steven Kirk
@grokys
Mar 18 2016 00:07
ok, so for horizontal and vertical you could probably use StackPanel (or at least the measure/arrange code from there if it's slightly different)
not sure what organizing by canvas size means exactly...
Darnell Williams
@Seeker1437
Mar 18 2016 00:08
One sec :D
Sorry, CanvasOrganizer would basically ensure items don't go beyond the boundsof the Canvas
Steven Kirk
@grokys
Mar 18 2016 00:10
so they would be stacked on top of each other?
Darnell Williams
@Seeker1437
Mar 18 2016 00:11
right
allows for an MDI feel
Steven Kirk
@grokys
Mar 18 2016 00:12
ok, a basic Panel does that
so you have two options: either swap out the panel that's arranging the child controls depending on the layout
so swap between a Panel and StackPanel (this could also be whatever the user wants)
or write your own Panel subclass which has a switch to change modes
changing the panel has the advantage that the user could use their own implementation
kinda like ItemsPresenter/ItemsControl use the ItemsPanel template
@cwensley listening to your .net rocks episode now
thanks for the shoutout ;)
Steven Kirk
@grokys
Mar 18 2016 00:17
i was thinking: i was wondering if we could somehow consolidate our binding code between the frameworks. I'm not that familiar with how Eto.Forms does binding, but from what your say it sounds like it's similar to WPF, is that correct?
Steven Kirk
@grokys
Mar 18 2016 00:18
because ours is also very similar to WPF, with a few additions like {Binding #controlName.Property} and {Binding !Value}
Darnell Williams
@Seeker1437
Mar 18 2016 00:18
basically in case I described it incorrectly
Steven Kirk
@grokys
Mar 18 2016 00:19
@Seeker1437 ok, it looks like you're kinda rewriting the existing layout system
like i say, that may be a valid approach, but it'd be worth seeing if you could do it with the existing system
that way you could easily support margins, padding, alignments etc
danwalmsley
@danwalmsley
Mar 18 2016 00:20
@Seeker1437 is this related to docking?
oh yeh seems so
Darnell Williams
@Seeker1437
Mar 18 2016 00:25
it is :D
Darnell Williams
@Seeker1437
Mar 18 2016 03:14
not sure how to share the templates!
Curtis Wensley
@cwensley
Mar 18 2016 05:45
grokys, you're welcome! Eto.Forms' binding is not similar to WPF, it provides much more functionality and is primarily code based. The Xaml binding markup extension still needs updating to take advantage of these features though. For example, binding a property in a view model in C#: myTextBox.BindDataContext(c => c.Text, (MyModel m) => m.MyProperty). There's extensions for conversion, using delegates, hooking up change events, etc.
e.g. this is a fun one: myTextBox.TextBinding.WhenLostFocus().Convert(i => i.ToString(), s => int.Parse(s)).BindDataContext((MyModel m) => m.IntProperty);
Darnell Williams
@Seeker1437
Mar 18 2016 06:01
.......
Woah
Eto.Forms:O
DOesn't it get kinda messy that way though?
Curtis Wensley
@cwensley
Mar 18 2016 06:03
it can, but separating on each line helps, and using conversion methods instead of delegates can help. sometimes easier than providing a converter class like in wpf.
it's more of a 'fluent' api, if you're familiar with that
Darnell Williams
@Seeker1437
Mar 18 2016 06:04
I was taking a look at everything, how long has Eto Be under development :O
Curtis Wensley
@cwensley
Mar 18 2016 06:04
since 2006 (;
Darnell Williams
@Seeker1437
Mar 18 2016 06:05
How have I NOT heard of Eto until a couple day agao D:
Curtis Wensley
@cwensley
Mar 18 2016 06:05
with a few years hiatus until monomac came out
Darnell Williams
@Seeker1437
Mar 18 2016 06:05
ah that answers that
XD
Curtis Wensley
@cwensley
Mar 18 2016 06:05
it was open sourced in 2011.
Darnell Williams
@Seeker1437
Mar 18 2016 06:06
5 year anniversay soon? (of being open sourced)
Curtis Wensley
@cwensley
Mar 18 2016 06:06
yeah.. funny how time flies
I'm really happy to be working on this mostly full time now, it's really getting things moving much faster.
Darnell Williams
@Seeker1437
Mar 18 2016 06:08
Well all I have to say is that you have great talent, keep up the great work, I will continue to work my way out of noob status :P HAHAHA XD
I have mades places to play with and text Eto :D
Curtis Wensley
@cwensley
Mar 18 2016 06:10
Hehe, thanks! (;
Darnell Williams
@Seeker1437
Mar 18 2016 06:11
lol test, So theoretical simple applications written in Eto will run on the supposed platforms, similarly to Perspex
Curtis Wensley
@cwensley
Mar 18 2016 06:12
even not so simple, yes.
I don't mean to tout Eto here though, it should probably be focussed on Perspex talk.
Darnell Williams
@Seeker1437
Mar 18 2016 06:13
I have this strong feeling that if I get to learn to and Perspex, that, I will be set at my next job XD
Yeah XD
Sorry about that
Curtis Wensley
@cwensley
Mar 18 2016 06:14
probably, Perspex is really the 'next gen wpf/silverlight' that people really want in many ways
Darnell Williams
@Seeker1437
Mar 18 2016 06:15
It's weird for me because Perspex shows characteristic similar to WPF but then everything that isn't built into WPF that i used to have to write a library for is built right in
Visual and Logical Tress access is a breeze XD
ReactiveUI is baked right in
Samefor a pretty powerful logging utility.... devtools XD
I like it
Curtis Wensley
@cwensley
Mar 18 2016 06:20
Yeah Perspex seems to have some very cool features.. and in a lot of ways more than MS' offerings.
Darnell Williams
@Seeker1437
Mar 18 2016 06:29
yep :D
Steven Kirk
@grokys
Mar 18 2016 09:00
don't worry about talking about Eto here - you did plug us on the radio after all, haha. but no, it's useful to compare approaches as well.
i like your code binding approach. we have something similar, but probably less flexible.
although it's all based on observables which provides quite a lot of flexibility outside of that provided by perspex
Alexey
@flcl42
Mar 18 2016 09:59
Are perspex sample projects compatible with Designer plugin? Have some designer errors raised by Sidebar.xaml file which contains styles in ControlCatalog project.
Oh, nice, removing style include from App.xaml fixed all.
Steven Kirk
@grokys
Mar 18 2016 11:08
yeah, that's a problem with OmniXAML at the moment
Darnell Williams
@Seeker1437
Mar 18 2016 13:07

@grokys VS is complaining about a type not being inferred, I cannot figure out how to fix it.

var canExecuateMaximize = this.WhenAny(x => x.GetFloatingItemState, 
    x => x.Value != WindowState.Maximized);

GetFloatingItemState is a static method that returns a WindowState, which means x.Value should be a WindowState

FloatingItemState is an Attached Property
Alexey
@flcl42
Mar 18 2016 13:44
What type of this?
Steven Kirk
@grokys
Mar 18 2016 13:58
WhenAny can't be used on a method
Denis Zaporozhets
@QuantumDeveloper
Mar 18 2016 14:04
blob
Darnell Williams
@Seeker1437
Mar 18 2016 14:07
this is Layout
Denis Zaporozhets
@QuantumDeveloper
Mar 18 2016 14:07
with new Grid
Steven Kirk
@grokys
Mar 18 2016 14:08
this.WhenAny(x => x.GetFloatingItemState -- GetFloatingItemState is a method, no?
Darnell Williams
@Seeker1437
Mar 18 2016 14:08
ah yes
Denis Zaporozhets
@QuantumDeveloper
Mar 18 2016 14:08
I hope it will be approved
Steven Kirk
@grokys
Mar 18 2016 14:08
you can't use rxui's WhenAny on a method
Darnell Williams
@Seeker1437
Mar 18 2016 14:08
Is there a way around it?
Steven Kirk
@grokys
Mar 18 2016 14:08
@QuantumDeveloper well we need to hear back about the legal issue still
Denis Zaporozhets
@QuantumDeveloper
Mar 18 2016 14:09
yeah, I know
just trying to say that seems i cracked that algorithm and understood what was missing
Steven Kirk
@grokys
Mar 18 2016 14:09
oh, great!
@Seeker1437 if this is a PerspexObject just use this.GetObservable(FloatingItemStateProperty)
Denis Zaporozhets
@QuantumDeveloper
Mar 18 2016 14:10
they calculate cells based on span, not on intersection of rows and columns how I was thinking
Steven Kirk
@grokys
Mar 18 2016 14:10
so the new Grid is all working with Avalon Studio now?
Denis Zaporozhets
@QuantumDeveloper
Mar 18 2016 14:11
@grokys I dont know about all, but at least basic layout is correctly calculated. Tests also passes
Darnell Williams
@Seeker1437
Mar 18 2016 14:11
Thanks grokys, that... makes life!
Steven Kirk
@grokys
Mar 18 2016 14:14
GetObservable is a Perspex feature, so it knows about attached properties. WhenAny is an RxUI feature so it just works with INotifyPropertyChanged
Denis Zaporozhets
@QuantumDeveloper
Mar 18 2016 14:15
@grokys both your test applications working (even that with Window max size)
Steven Kirk
@grokys
Mar 18 2016 14:15
cool!
Denis Zaporozhets
@QuantumDeveloper
Mar 18 2016 14:16
you know, even copy something from MS sources and correctly apply to your code is a real challenge
Steven Kirk
@grokys
Mar 18 2016 14:17
well, don't copy then ;)
Denis Zaporozhets
@QuantumDeveloper
Mar 18 2016 14:18
I dont want to repeat that in future)
Steven Kirk
@grokys
Mar 18 2016 14:18
if you're reverse engineering, you shouldn't even look at incompatibly licenced code
unit tests are the way to reverse engineer
Denis Zaporozhets
@QuantumDeveloper
Mar 18 2016 14:18
yeah, and they helped in some parts
but Grid is so not obvious, that I think I never could understand what is wrong if I didnt look at the sources
danwalmsley
@danwalmsley
Mar 18 2016 14:20
@QuantumDeveloper do you know there is a rendering improvement for Avalon studio with your new grid?
Denis Zaporozhets
@QuantumDeveloper
Mar 18 2016 14:21
@danwalmsley have no idea, but definately it should be much faster
Darnell Williams
@Seeker1437
Mar 18 2016 14:23
oooh so @grokys this would be correct compared to what I sent you originally?
var canExecuateMaximize = this.GetObservable(FloatingItemStateProperty).Select(x => x != WindowState.Maximized);
Steven Kirk
@grokys
Mar 18 2016 14:33
yep!
yeah, true blind reverse engineering is hard. it is possible though, just look at wine and mono!
Denis Zaporozhets
@QuantumDeveloper
Mar 18 2016 14:40
and moonlight)))
Darnell Williams
@Seeker1437
Mar 18 2016 14:40
also look at Aura Project http://github.com/aura-project/aura true reverse engineering for a game I played for 5 years XD
danwalmsley
@danwalmsley
Mar 18 2016 14:58
@grokys one thing iv noticed with Perspex is:
 <ListBox.ItemTemplate>
        <DataTemplate>
          <TextBlock Text="{Binding Title}"/>
        </DataTemplate>
      </ListBox.ItemTemplate>
that works in WPF
but the Perspex equivalent AFAIK
forces your template to specify a target type
why is handy since you don't need to put a namespace in for your viewmodel
and most of the time you might only be templating a single data type
unless there is something iv missed in Perspex?
ok I'm talking shit
it does work without datatype!
Wiesław Šoltés
@wieslawsoltes
Mar 18 2016 15:01
this was changed by @grokys recently
and it proves very usefull
Steven Kirk
@grokys
Mar 18 2016 15:01
:D
Wiesław Šoltés
@wieslawsoltes
Mar 18 2016 15:02
as I can use generics :smile:
Steven Kirk
@grokys
Mar 18 2016 15:02
a long time ago, it caused problems because i was using data templates to select members for the TabControl, however that was changed which allowed DataTemplates without types
danwalmsley
@danwalmsley
Mar 18 2016 15:16
@grokys would this be correct?
    <ListBox Items="{Binding Templates}" SelectedItem="{Binding SelectedTemplate}">
      <ListBox.DataTemplates>
        <DataTemplate>
          <TextBlock Text="{Binding Title}"/>
        </DataTemplate>
      </ListBox.DataTemplates>
    </ListBox>
that just shows the Type name
and not the datatemplate
danwalmsley
@danwalmsley
Mar 18 2016 15:23
sorry false alarm its working
Darnell Williams
@Seeker1437
Mar 18 2016 16:46
@grokys is our physical unti size the same as WPF (aka 96d)
Steven Kirk
@grokys
Mar 18 2016 16:50
yeah
Darnell Williams
@Seeker1437
Mar 18 2016 16:54
Thank!