These are chat archives for AvaloniaUI/Avalonia

3rd
Jan 2015
Glenn Block
@glennblock
Jan 03 2015 06:32
Weighing in on Prism, which was my
project btw....
Region
regions are an abstraction for doing composite layouts
Basically regions get content dynamically injected into them and they can be accessed by name
As far as Prism being over engineered is that based on experience using it or FUD?
Prism lets you use as little or as much as you need. It is specifically designed for composite apps though.
Apps that are composed of a series of modules which contribute different capabilities
It is now designed for every single UI app. Yes it does bring some complexity, but composite apps are complex and in that world it helps manage the complexity
But moving on.....
I wouldn't necessarily worry about regions up front. That is something that could easily be added
either as an add-on or into the core, later...
Glenn Block
@glennblock
Jan 03 2015 06:39
This message was deleted
RegionManager is a service that lets you get access to the different regions in the UI to allow
injecting content.
José Manuel Nieto
@SuperJMN
Jan 03 2015 11:54
hey guys, do you think that a dependency property is a good way to communicate binding errors to the GUI?
(an attached property)
for example: when binding a TextBox.Text property (string) to a number and the user enters "hi"
there is a data error
the GUI should have a decoupled way to find out
Steven Kirk
@grokys
Jan 03 2015 11:57
i'm not sure of the best way tbh... i just know that there's no validatation framework that i've used that i've been happy with
José Manuel Nieto
@SuperJMN
Jan 03 2015 11:57
me neither
well, I used one that was pretty solid,
Steven Kirk
@grokys
Jan 03 2015 11:57
reactiveui gave it a go, and then removed it for the next version because they weren't happy with it
José Manuel Nieto
@SuperJMN
Jan 03 2015 11:57
Cinch by Sacha Barber
they used DataWrappers<T>
Steven Kirk
@grokys
Jan 03 2015 11:57
ah yeah i look at that many years ago
that's a rather heavyweight solution
José Manuel Nieto
@SuperJMN
Jan 03 2015 11:58
each DataWrapper had rules
Steven Kirk
@grokys
Jan 03 2015 11:58
(though probably a good one if you don't mind the perf/size hit)
José Manuel Nieto
@SuperJMN
Jan 03 2015 11:58
yes
Steven Kirk
@grokys
Jan 03 2015 11:58
it's definitely something that needs thinking about
José Manuel Nieto
@SuperJMN
Jan 03 2015 11:59
but I don't know if having Rx we can get benefit in this are, maybe it doesn't change anything
Steven Kirk
@grokys
Jan 03 2015 11:59
but probably later, i'd say
not sure
José Manuel Nieto
@SuperJMN
Jan 03 2015 11:59
yes, at the moment, when I bind a string to an int, when the data cannot be converted, it just ignores it
Steven Kirk
@grokys
Jan 03 2015 11:59
yeah, for the moment i'd be happy with that
we've not even got dropdown/comboboxes yet ;)
José Manuel Nieto
@SuperJMN
Jan 03 2015 12:00
also, I'm starting wonder how the GUI could react to changes in the VM
like changing the style of something depending on a prop in the VM
haha, OK!
Steven Kirk
@grokys
Jan 03 2015 12:01
the way to do that would probably be to set a class on the control depending on a property on the vm
José Manuel Nieto
@SuperJMN
Jan 03 2015 12:01
:O
a style class?
Steven Kirk
@grokys
Jan 03 2015 12:02
yeah a style class
José Manuel Nieto
@SuperJMN
Jan 03 2015 12:02
I don't understand well what you say
in WPF you have Style.Triggers
Steven Kirk
@grokys
Jan 03 2015 12:03
yes, there are no triggers so far in the perspex style system
José Manuel Nieto
@SuperJMN
Jan 03 2015 12:03
I hope in Perspex we could have good ways to do the same!
Steven Kirk
@grokys
Jan 03 2015 12:03
it's more like CSS
José Manuel Nieto
@SuperJMN
Jan 03 2015 12:03
so, if I want a button to be visible or not depending on a VM?
is there a way to do it?
Steven Kirk
@grokys
Jan 03 2015 12:04
if you look at the code there
on that line, the :checked pseudo-class is added to the control whenever IsChecked is set to true
José Manuel Nieto
@SuperJMN
Jan 03 2015 12:04
I'm looking at it now
José Manuel Nieto
@SuperJMN
Jan 03 2015 12:05
aha! nice!
Steven Kirk
@grokys
Jan 03 2015 12:05
at that line in the CheckBox style, the tick is hidden or removed based on whether :checked is present on the checkbox
sorry, shown or hidden
José Manuel Nieto
@SuperJMN
Jan 03 2015 12:06
look way cool!
I wonder how that could be done in XAML
Steven Kirk
@grokys
Jan 03 2015 12:06
well the selectors have a string representation
which is very similar to CSS selectors
ive not actually written a parser for it though yet!
José Manuel Nieto
@SuperJMN
Jan 03 2015 12:07
haha
hard work there!
Steven Kirk
@grokys
Jan 03 2015 12:07
so the styles would either be done in a pure CSS type format
José Manuel Nieto
@SuperJMN
Jan 03 2015 12:08
argh, I have to think a lot about that
Styles should be allowed in XAML
Steven Kirk
@grokys
Jan 03 2015 12:09
or they could be something like <Style Selector="CheckBox:checked $ checkMark"><Setter Property="IsVisible" Value="False"/></Style>
José Manuel Nieto
@SuperJMN
Jan 03 2015 12:09
but that is like a header?
Steven Kirk
@grokys
Jan 03 2015 12:10
($ in a selector is the char i randomly chose to mean "in the control's template")
a header?
José Manuel Nieto
@SuperJMN
Jan 03 2015 12:10
yes, I mean, are styles a integral part of each control?
of are they like "skins"
Steven Kirk
@grokys
Jan 03 2015 12:10
controls are lookless like in WPF
José Manuel Nieto
@SuperJMN
Jan 03 2015 12:10
a control.Style?
Steven Kirk
@grokys
Jan 03 2015 12:11
Control.Styles is a thing, yes
José Manuel Nieto
@SuperJMN
Jan 03 2015 12:11
Styles?
more than one?
oh yeah
and styles can even be nested ;)
(there's good reason for that, i didn't just go mad ;) )
so you could e.g. put a whole new theme in a part of the application
José Manuel Nieto
@SuperJMN
Jan 03 2015 12:13
oh myyy
José Manuel Nieto
@SuperJMN
Jan 03 2015 12:13
I should check styles VERY well in order to be able to define them in XAML
Steven Kirk
@grokys
Jan 03 2015 12:13
that's the defaut theme
inherits from Styles
and Styles implements IStyle
José Manuel Nieto
@SuperJMN
Jan 03 2015 12:14
for instance, how do you make a specific button to have a Style that inherits from the default one?
Steven Kirk
@grokys
Jan 03 2015 12:15
there's no such thing as inheriting styles in perspex currently
it's more like CSS
i hated all that style inheritance stuff in WPF
so you'd have to give a more concrete example of a requirement
José Manuel Nieto
@SuperJMN
Jan 03 2015 12:17
Let me think about it
I'm very confused because I don't see how Styles will be defined in XAML
I don't see it clear, but taking a look into your code I think I will eventually come up with something
Steven Kirk
@grokys
Jan 03 2015 12:18
i don't think they would be much different to in WPF
except that the selector would be more complex
José Manuel Nieto
@SuperJMN
Jan 03 2015 12:19
the whole thing in XAML would be
Steven Kirk
@grokys
Jan 03 2015 12:19
that wouldn't be a problem i don't think
José Manuel Nieto
@SuperJMN
Jan 03 2015 12:19
<Button>
<Button.Style>
<Style TargetType=....>
<Style.Triggers>
<DataTrigger Binding=....
and there, the Setters
with the new styling engine, I don't know how to do that :S
Steven Kirk
@grokys
Jan 03 2015 12:21
i imagine something like
<Button>
  <Button.Styles>
    <Style Selector="CheckBox:checked $ checkMark">
      <Setter Property="IsVisible" Value="False"/>
    </Style>    
  </Button.Styles>
</Button>
Steven Kirk
@grokys
Jan 03 2015 12:27
to do that we'd need a selector string parser
and a style ctor that takes a string
José Manuel Nieto
@SuperJMN
Jan 03 2015 12:29
and how to make that with a Binding to the VM?
Steven Kirk
@grokys
Jan 03 2015 12:29
or actually - just a type converter from selector string to Selector
José Manuel Nieto
@SuperJMN
Jan 03 2015 12:29
Value={Binding...}
or something like that?
Steven Kirk
@grokys
Jan 03 2015 12:29
hmm
that's something i've not thought about yet
José Manuel Nieto
@SuperJMN
Jan 03 2015 12:30
haha
OK
I will take it
I have to do some tests and see how it behaves
Steven Kirk
@grokys
Jan 03 2015 12:30
you mean setting a class on the control based on a VM property?
José Manuel Nieto
@SuperJMN
Jan 03 2015 12:30
for instance, yes
Steven Kirk
@grokys
Jan 03 2015 12:31
yes, that's all done in code atm
José Manuel Nieto
@SuperJMN
Jan 03 2015 12:31
of example, depending on a Attached Property, the TextBox with a Data Error should be outlined in red
Steven Kirk
@grokys
Jan 03 2015 12:32
ok, thinking out loud here...
José Manuel Nieto
@SuperJMN
Jan 03 2015 12:32
how would that be achieved in XAML?
(I've got to leave, but will read later!)
thanks for the ideas :)
Steven Kirk
@grokys
Jan 03 2015 12:32
for that i could imagine that the attached property sets an :error class on the control
ok, speak later
@glennblock re:Prism - I didn't realise that was your project. it's true: it's more based on FUD that any real-world usage.
i remember checking it out in the early days of WPF when it was being suggested that it could be used as an MVVM framework
i remember looking at the docs and thinking "woah! complicated!"
and that's about it
Steven Kirk
@grokys
Jan 03 2015 12:38
that will teach me to spout off about things i have no knowledge about on the internet ;)
but as i understand it, it's a higher level abstraction that should probably be built upon the framework rather than included in it?
Steven Kirk
@grokys
Jan 03 2015 12:48
like i say, at the moment i'm more thinking about getting the basics down that any higher-level stuff
like i said before: combobox
and speaking of which, i was thinking of diverging slightly from WPF on this
would like to hear opinions
i'm thinking that ComboBox will be a subclass of DropDown
DropDown will give the more common functionality of a drop down list without the editable part
but rather than the selected content being displayed as a string, it will be a ContentPresenter
which will allow for any content to be displayed in any way in the control
ComboBox will derive from this and replace the ContentPresenter with a TextBox
to be handled using the basic DropDown control
Steven Kirk
@grokys
Jan 03 2015 15:06
ok, build fixed on VS2015 CTP now
Glenn Block
@glennblock
Jan 03 2015 19:05
On the XAML parser, another idea is look to Xamarin. Xamarin Forms supports XAML. Maybe the parser it uses is OSS
José Manuel Nieto
@SuperJMN
Jan 03 2015 20:19
@grokys "i'm more thinking about getting the basics down that any higher-level stuff" +1
@glennblock I MUST take a look at it! at the moment it's not my priority as far as I user the one in System.Xaml just to focus on features
XAML is still a proof-of-concept
If I can continue withouht getting bloked and the thing gets some entity, I could think of making it crystallize
José Manuel Nieto
@SuperJMN
Jan 03 2015 20:24
I mean, if features for XAML keep on and offer nice improvements, I will have to get back to the roots of the XAML thingy and look for replacement
but until I know it is worth the effort, I will go this way
by the way @grokys I would like to work in ValueConverters for bindings
the way they work usually require another Markup Extensions: StaticResource
have you thought of resources?
WPF and the XAML stack have ResourceDictionaries
will Perspex have something like that?
I suppose that each PerspexObject should then contain a collection of resources