These are chat archives for AvaloniaUI/Avalonia

30th
Mar 2016
Gutemberg Ribeiro
@galvesribeiro
Mar 30 2016 00:34
@grokys re memory leak, Cairo has something as well for it... It actually print on whatever output the stacktrace on where it is leaking...
Quentin Homareau
@kuashe
Mar 30 2016 08:15
Does perspex can integrate with third party plugins ? Openstreet maps
of stuff liek that
Steven Kirk
@grokys
Mar 30 2016 10:34
no, we don't have anything like that yet - we're still at the level of implementing basic controls
danwalmsley
@danwalmsley
Mar 30 2016 16:06
@grokys I'm going to try and implement the opacity mask tonight
Steven Kirk
@grokys
Mar 30 2016 16:06
that would be great
btw how is the dark theme coming along?
danwalmsley
@danwalmsley
Mar 30 2016 16:06
I believe from briefly looking into it, that the OpacityMask will be of type brush and on any IVisual
yeh I still need to do more work on dark theme
needs a lot of polishing
but il be getting back to it soon
I think I might end up modifying some templates slightly to make things look a bit better, like the scroll bars
but that will benefit light and dark
Steven Kirk
@grokys
Mar 30 2016 16:08
ok sure
danwalmsley
@danwalmsley
Mar 30 2016 16:08
what do you think of this
in the light theme
    <SolidColorBrush x:Key="ThemeBorderLightBrush">#FFAAAAAA</SolidColorBrush>
    <SolidColorBrush x:Key="ThemeBorderMidBrush">#FF888888</SolidColorBrush>
    <SolidColorBrush x:Key="ThemeBorderDarkBrush">#FF333333</SolidColorBrush>
you have names like Light, Mid and Dark
but when I make this a dark theme those names don't make sense
because my Light brush is actually a dark one
and the dark a light one!!
any suggestion how to overcome this?
Steven Kirk
@grokys
Mar 30 2016 16:16
danwalmsley
@danwalmsley
Mar 30 2016 18:02
@grokys what do you think about bringing all those styles that are on UWP to Perspex?
Steven Kirk
@grokys
Mar 30 2016 18:03
when i first started doing it, i tried that, but i found it way to complex
if you want to try you're welcome!
danwalmsley
@danwalmsley
Mar 30 2016 18:56
@grokys just came across an interesting issue #491
Steven Kirk
@grokys
Mar 30 2016 19:03
hmm, ok. i'm afraid i only have a single monitor at the moment so I'm not able to fix that one :(
Steven Kirk
@grokys
Mar 30 2016 19:16
sounds pretty bad though - it hangs the whole system?!
danwalmsley
@danwalmsley
Mar 30 2016 19:17
well you can move mouse, but because its in a drag
unless you do ctrl alt del
you cant get it to leave the Perspex windows focus some how
@grokys how easy would it be to implemend in styles BasedOn
  <Style x:Key="HeaderTextBlockStyle" TargetType="TextBlock"
       BasedOn="{StaticResource BaseTextBlockStyle}">
      <Setter Property="FontSize" Value="46"/>
      <Setter Property="FontWeight" Value="Light"/>
      <Setter Property="OpticalMarginAlignment" Value="TrimSideBearings"/>
    </Style>
danwalmsley
@danwalmsley
Mar 30 2016 19:22
that will be really powerful for doing the themes
I'm hoping it might be a quick easy one!!!
Steven Kirk
@grokys
Mar 30 2016 19:23
well styles in perspex already have an implicit BasedOn as multiple styles can apply to a single control
danwalmsley
@danwalmsley
Mar 30 2016 19:23
ah nice
easy solution then
how would you clear out all existing styles?
Steven Kirk
@grokys
Mar 30 2016 19:24
there's currently no way to do that
if you mean "stop traversing styles when this style is reached"
have you done much CSS? you need to change your mindset to think more like CSS than WPF/UWP
so "clear out existing styles" doesn't make much sense
danwalmsley
@danwalmsley
Mar 30 2016 19:32
ok sure, its been a while on css
but its definitely better than WPF
do you know if its possible to see the control templates for UWP?
I want to see where in a button they applied which of those colors
in the Xaml Theme resource
Jeremy Koritzinsky
@jkoritzinsky
Mar 30 2016 19:33
Do we have an equivalent of ItemTemplate on an ItemsControl?
Steven Kirk
@grokys
Mar 30 2016 19:34
@jkoritzinsky not currently, no - just add a template to the DataTemplates collection
Jeremy Koritzinsky
@jkoritzinsky
Mar 30 2016 19:34
Ok. And the ItemsControl will correctly pick it up as a template for the items?
Steven Kirk
@grokys
Mar 30 2016 19:35
@danwalmsley you can actually see the UWP templates at (Program Files)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP\<SDK version>\Generic
@jkoritzinsky yep, that's the theory!
you can optionally add a TargetType of the type of the model
Jeremy Koritzinsky
@jkoritzinsky
Mar 30 2016 19:36
Ok. I'll try it out when I've got a chance.
danwalmsley
@danwalmsley
Mar 30 2016 19:37
@grokys I'm working out how to style the buttons based off uwp... it seems the light and dark theme needs some other color behind it... i.e.
<SolidColorBrush x:Key="SystemBaseLowColor">#33FFFFFF</SolidColorBrush>
Steven Kirk
@grokys
Mar 30 2016 19:37
yep i got into the process of porting all that, but gave up as it kinda became a maze...
danwalmsley
@danwalmsley
Mar 30 2016 19:38
not sure where the button would get its color from, in Perspex window with white background
that will look pure white
Steven Kirk
@grokys
Mar 30 2016 19:38
you have to follow the UWP styles up
danwalmsley
@danwalmsley
Mar 30 2016 19:38
ok ill dig a little deeper
(Program Files)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP\<SDK version>\Generic
what do you install to get that windows 10 sdk?
seems so
Steven Kirk
@grokys
Mar 30 2016 19:41
hmm, not sure - it's already installed on my machine
maybe because i installed the uwp sdk with VS
danwalmsley
@danwalmsley
Mar 30 2016 19:45
@grokys seems Perspex isn't liking this kind of thing...
<TextBlock Text="Header" Styles="{StyleResource HeaderTextBlockStyle}" />
Steven Kirk
@grokys
Mar 30 2016 19:45
yeah, again, because our styling system is completely different
you don't apply styles to controls, styles select controls
danwalmsley
@danwalmsley
Mar 30 2016 20:03
@grokys what would the Perspex equivalent be
I guess youd have to give the TextBlock a class?
like in CSS is that possible?
danwalmsley
@danwalmsley
Mar 30 2016 20:28
dark theme is going to look amazing!!!
Steven Kirk
@grokys
Mar 30 2016 20:37
yeah, you'd give it a class
Steven Kirk
@grokys
Mar 30 2016 20:51
man - if you've not updated to VS2015 Update 2 yet I'd advise it - NuGet is soooo much faster! no longer painful to use!
danwalmsley
@danwalmsley
Mar 30 2016 21:14
do you just check for updates or is it a separate download?
Darnell Williams
@Seeker1437
Mar 30 2016 21:18
if i can recommend, why not follow the MahApps.Metro style?
danwalmsley
@danwalmsley
Mar 30 2016 21:19
I'm just getting the basic resources first
Darnell Williams
@Seeker1437
Mar 30 2016 21:20
Just a base pattern aka xcolor1 xcolor2 and stuff like that
danwalmsley
@danwalmsley
Mar 30 2016 21:20
yeh
well in uwp there is no base colour
Darnell Williams
@Seeker1437
Mar 30 2016 21:20
instead of saying whether its dark or not and just filling in approximately
danwalmsley
@danwalmsley
Mar 30 2016 21:20
buttons are just shaded a little darker or lighter than background colour
they are essentially transparent which is nice
Darnell Williams
@Seeker1437
Mar 30 2016 21:20
exactly
danwalmsley
@danwalmsley
Mar 30 2016 21:20
from there I will maybe start to port over some of the mahapps templates
to get nicer more finished buttons
and controls, etc
man someone is going to have to do something with the Perspex designer its unusuable
Steven Kirk
@grokys
Mar 30 2016 21:27
yeah, it really is... a lot of the problems come from OmniXAML problems though
although if you're talking about the bug that keeps exes and dlls alive, that's not ;)
i actually don't use the designer because it just means i have to restart VS every 10 mins
Darnell Williams
@Seeker1437
Mar 30 2016 21:29
About releasing dlls i have been working on that
Inagine me,who is pretty noob trying to test the docking stuff and I get frustrated having to go through and kill the designer manually
The part that sicks is that only 90% of the time works
Steven Kirk
@grokys
Mar 30 2016 21:31
yeah, it's weird that it mostly works
danwalmsley
@danwalmsley
Mar 30 2016 21:33
@grokys the style system wont let me do
Darnell Williams
@Seeker1437
Mar 30 2016 21:33
Ih yeah thats the bext thing Inwant to do
danwalmsley
@danwalmsley
Mar 30 2016 21:34
<SolidColorBrush x:Key="MyColor" Color="{StyleResource MyColorResource} />
Darnell Williams
@Seeker1437
Mar 30 2016 21:34
A Style Resolver,
Steven Kirk
@grokys
Mar 30 2016 21:34
yeah, because our SolidColorBrush is immutable. for now there's a hack though.
Darnell Williams
@Seeker1437
Mar 30 2016 21:34
Yeah thats the work if a dictionary really
Steven Kirk
@grokys
Mar 30 2016 21:34
add xmlns:mut="https://github.com/perspex/mutable"
Darnell Williams
@Seeker1437
Mar 30 2016 21:34
Oh there is?
Steven Kirk
@grokys
Mar 30 2016 21:34
and use mut:SolidColorBrush
Darnell Williams
@Seeker1437
Mar 30 2016 21:36
Do you think it would be fair to allow the designer to let people visualize styles?
Steven Kirk
@grokys
Mar 30 2016 21:37
in what way?
Darnell Williams
@Seeker1437
Mar 30 2016 21:37
Normally those arent visualized
Steven Kirk
@grokys
Mar 30 2016 21:37
well styles are applied to the controls in the designer preview
i don't see how you would visualize styles themselves though
Darnell Williams
@Seeker1437
Mar 30 2016 21:39
I was thinking we could evalute the selector and try to grab the control if available xD
Steven Kirk
@grokys
Mar 30 2016 21:39
hmm, still not sure what you mean
Darnell Williams
@Seeker1437
Mar 30 2016 21:40
So say my style is like Selector="local|DockItem"
then in the designer, i try to grab dockitem display it in the designer with the style applied
danwalmsley
@danwalmsley
Mar 30 2016 21:40
@grokys is this allowed?
<Color x:Key="SystemAltHighColor">#FF000000</Color>
Darnell Williams
@Seeker1437
Mar 30 2016 21:41
When the root is Styles
Steven Kirk
@grokys
Mar 30 2016 21:41
@danwalmsley yeah that's allowed
@Seeker1437 ahh ok when the root is Styles, i understand now
might be useful! not sure, i've not seen anything that does that before!
Darnell Williams
@Seeker1437
Mar 30 2016 21:43
wouls be interesting to test
I have one last request actually
danwalmsley
@danwalmsley
Mar 30 2016 21:44
cant the designer make its own copy of the executables it loads... so it doesn't conflict with compiler?
Darnell Williams
@Seeker1437
Mar 30 2016 21:45
@danwalmsley yeah usually tempPE is used by XDesProc for example
But honestly that can get messy
We still dont fully detect changes in projectdirs or outputpaths at the moment
I say that for the cases where things move and the designer isnt going to know where thing are should it happen
Steven Kirk
@grokys
Mar 30 2016 21:50
oh awesome, VS update 2 has support for .net standard platform
danwalmsley
@danwalmsley
Mar 30 2016 21:52
@grokys whats .net standard platform?
@grokys also Foreground property seems like it should on a different class
basically a better PCL
danwalmsley
@danwalmsley
Mar 30 2016 21:53
in WPF I can set foreground on ContentPresenter, but on Perspex I cant
can I move it?
Steven Kirk
@grokys
Mar 30 2016 21:54
not sure it should be moved...
danwalmsley
@danwalmsley
Mar 30 2016 21:55
take a look here:
Steven Kirk
@grokys
Mar 30 2016 21:55
in perspex it's on TemplatedControl and in WPF in Control which are equivalent
danwalmsley
@danwalmsley
Mar 30 2016 21:55
ah so maybe content control should inherit template control?
in the example in link
it shows that they set foreground of the content control in button
on mouse pressed
and pointer over
I was trying to add that part
to new themes
Steven Kirk
@grokys
Mar 30 2016 21:56
ContentControl is a templated control - you mean ContentPresenter?
danwalmsley
@danwalmsley
Mar 30 2016 21:57
contentpresenter
Steven Kirk
@grokys
Mar 30 2016 21:58
ok, in WPF it's not present on ContentPresenter
but it's actually just an alias for the TextBlock.Foreground attached property
so just use that
we could add it to ContentPresenter in the same way that TemplatedControl adds it though
danwalmsley
@danwalmsley
Mar 30 2016 22:00
public static readonly StyledProperty<Brush> ForegroundProperty =
            TextBlock.ForegroundProperty.AddOwner<ContentPresenter>();
Steven Kirk
@grokys
Mar 30 2016 22:00
yeah, you could do that, but it'd only make sense if you also add a load of others too
just use TextBlock.Foreground for now
danwalmsley
@danwalmsley
Mar 30 2016 22:01
fontfamilyt
font size
, etc
?
Steven Kirk
@grokys
Mar 30 2016 22:01
yeah, i'm not sure i want to add all of them
just do <ContentPresenter TextBlock.Foreground="...">
danwalmsley
@danwalmsley
Mar 30 2016 22:02
  <Style Selector="Button:pressed  /template/ ContentPresenter">
    <Setter Property="Background" Value="{StyleResource SystemControlBackgroundBaseMediumLowBrush}"/>
    <Setter Property="BorderBrush" Value="{StyleResource SystemControlHighlightTransparentBrush}" />
    <Setter Property="Foreground" Value="{StyleResource SystemControlHighlightBaseHighBrush}" />
  </Style>
I need to do it in here
Steven Kirk
@grokys
Mar 30 2016 22:02
<Style Selector="Button:pressed  /template/ ContentPresenter">
    <Setter Property="Background" Value="{StyleResource SystemControlBackgroundBaseMediumLowBrush}"/>
    <Setter Property="BorderBrush" Value="{StyleResource SystemControlHighlightTransparentBrush}" />
    <Setter Property="TextBlock.Foreground" Value="{StyleResource SystemControlHighlightBaseHighBrush}" />
  </Style>
danwalmsley
@danwalmsley
Mar 30 2016 22:02
ok
cheers ;)
there seems to be a bug with animations
that become visible when you put it all on a black background
danwalmsley
@danwalmsley
Mar 30 2016 22:08
image.png
if you load test app with black backgroud
then switch tabs
I get that
might be my Window background is transparent not sure
code is here:
Steven Kirk
@grokys
Mar 30 2016 22:11
oh dear... yeah animations haven't really been tested much
hmm yeah, weird - it looks like there's no background set
unfortunately i can't see because i can't see the text in devtools ;)
Steven Kirk
@grokys
Mar 30 2016 22:18
right, i think this is because of a shortcoming where StyleResources can't be currently shared between different XAML files containing only styles
because: at the point where this line is parsed:
<mut:SolidColorBrush x:Key="SystemControlBackgroundAltHighBrush" Color="{StyleResource SystemAltHighColor}" />
the containing Style isn't attached to the parent style
so as far as the XAML parser knows, SystemAltHighColor isn't defined
WPF works around this in a truly horrible way
i didn't want to copy their way of working round it - i need to come up with an alternative solution
Steven Kirk
@grokys
Mar 30 2016 22:31
actually... i think i've got a solution to this
Darnell Williams
@Seeker1437
Mar 30 2016 23:20
Woot, btw how does wpf do it?