These are chat archives for AvaloniaUI/Avalonia

24th
May 2018
Nikita Tsukanov
@kekekeks
May 24 2018 05:47
Guys, I'm terribly sorry, didn't have much time and Skia backend changes kinda require to be read thoroughly
Jeremy Koritzinsky
@jkoritzinsky
May 24 2018 06:03
Hey don't worry about it too much! Everyone gets really busy every once in a while.
Rayyan Tahir
@RayyanTahir
May 24 2018 06:54
@danwalmsley I was actually trying to bring background transparency for Popup, but then I thought why not do the same for a Window. So Popup with transparency would be my actual use case and I'm going for Windowimpl first. @Sorien I believe DwmExtendFrameIntoClientArea wouldn't solve it.
danwalmsley
@danwalmsley
May 24 2018 07:29
@RayyanTahir it looks to me that you have done the right thing, the only part that is visible is the window chrome. Which in a popup isn't visible
If you assign a background of transparent perhaps it won't click through?
Rayyan Tahir
@RayyanTahir
May 24 2018 07:31
I tried setting the window's background to Transparent, but click-through does happen, and when i set it to #01FFFFFF I just get black color on the supposed-to-be transparent region
Like:
image.png
Stano Turza
@Sorien
May 24 2018 07:38
@RayyanTahir as far as I remenber color param doesn't contain alpha its just RGB
Rayyan Tahir
@RayyanTahir
May 24 2018 07:38
Yes, and that is the real pain. Providing an RGB with black color to accommodate for transparency is wrong IMO
So, I'll have to find another way
Stano Turza
@Sorien
May 24 2018 07:39
@RayyanTahir that API is from windows XP times
Rayyan Tahir
@RayyanTahir
May 24 2018 07:40
Actually Windows 2000 times :smile:
Stano Turza
@Sorien
May 24 2018 07:53
@RayyanTahir as far as i know there is just one way, i saw that implementation like 10 years ago, you can take screenshot of your desktop without your window and use it as background to simulate transparency, it was same implementation as "desktop alpha blending" at winamp's modern skins but for another player, but I don't have access to that sources anymore.
danwalmsley
@danwalmsley
May 24 2018 07:53
@RayyanTahir i didn't explain too well
Make your window transparent
As before
Then add a grid inside the window with 01Ffffff background
Does that prevent click through?
Stano Turza
@Sorien
May 24 2018 07:55
@danwalmsley that API is changing window shape
Rayyan Tahir
@RayyanTahir
May 24 2018 07:57
@Sorien That makes sense. I'll give that a try. @danwalmsley I did try as you said like below:
<Window xmlns="https://github.com/avaloniaui"
        Title="AvaloniaUI WindowTransparency Test"
        Background="Transparent"
        AllowTransparency="True"
        HasSystemDecorations="True"
        Width="800"
        Height="600">
  <Grid Background="#01FFFFFF">
    <Border Margin="30" Background="White" CornerRadius="20">
    <StackPanel>
      <TextBlock Text="Window Transparency Test"/>
      <TextBox Width="100" Height="30" Background="Black"/>
    </StackPanel>
  </Border>
  </Grid>
</Window>
I'm getting this effect:
image.png
danwalmsley
@danwalmsley
May 24 2018 07:59
Ah I see
That's because Avalonia doesn't have access to the stuff behind the window
To calculate the color when it alpha mixes
Rayyan Tahir
@RayyanTahir
May 24 2018 08:01
But the fact that I want to explain is that even if I did achieve a workaround for click-through problem, I still think using SetLayeredWindowAttributes api is not the best way. Because I'm basically providing an RGB color (without alpha) to tell the api that whenever you find this color, make it transparent. If i set black background color to TextBox like in the example above, the textbox is now both see-through and click-through
@Sorien gave me another way to handle this, but I'm not sure how good/bad it will be for performance
danwalmsley
@danwalmsley
May 24 2018 08:05
@RayyanTahir just tested on wpf
System.InvalidOperationException: 'WindowStyle.None is the only valid value for WindowStyle when AllowsTransparency is true.'
probably for the reason you have encountered
Rayyan Tahir
@RayyanTahir
May 24 2018 08:06
In Avalonia that would be HasSystemDecorations="False"?
danwalmsley
@danwalmsley
May 24 2018 08:06
yes
Benedikt Schroeder
@Gillibald
May 24 2018 08:07
When I developed my own custom window under WPF I encountered lots of bugs with transparency. Sometimes I had to change the BorderThickness just to get the transparency. It is a real pain.
danwalmsley
@danwalmsley
May 24 2018 08:07
its because it doesn't make sense to allow transparency and have window frame
Rayyan Tahir
@RayyanTahir
May 24 2018 08:07
image.png
Benedikt Schroeder
@Gillibald
May 24 2018 08:07
You draw your own in that case
Rayyan Tahir
@RayyanTahir
May 24 2018 08:08
:laughing:
danwalmsley
@danwalmsley
May 24 2018 08:08
<Window x:Class="WpfApp1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApp1"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800" AllowsTransparency="True" WindowStyle="None" Background="Transparent">
    <Border CornerRadius="20" BorderBrush="Red" BorderThickness="10" Background="Red" />
</Window>
that's wpf code for
image.png
can you get the same results with your implementation?
also does this work
image.png
<Window x:Class="WpfApp1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApp1"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800" AllowsTransparency="True" WindowStyle="None" Background="Transparent">
    <Border CornerRadius="20" BorderBrush="#5500FF00" BorderThickness="10" Background="Red" />
</Window>
where you can see though the border brush?
Rayyan Tahir
@RayyanTahir
May 24 2018 08:12
Checking
danwalmsley
@danwalmsley
May 24 2018 08:12
if that works then your implementation is good :)
Rayyan Tahir
@RayyanTahir
May 24 2018 08:13
image.png
@danwalmsley I see your point now with the HasSystemDecorations set to False. The problem still lies though with any control inside the window with Black background. The win32 api converted the black region to transparent and made it clickthrough
danwalmsley
@danwalmsley
May 24 2018 08:15
#
Stano Turza
@Sorien
May 24 2018 08:15
@RayyanTahir try to look at UpdateLayeredWindow function
Rayyan Tahir
@RayyanTahir
May 24 2018 08:16
@Sorien I'll try that
danwalmsley
@danwalmsley
May 24 2018 08:18
@RayyanTahir can you post the xaml you used there?
it might just be some issue with the rendering code in avalonia
Rayyan Tahir
@RayyanTahir
May 24 2018 08:18
Sure,
<Window xmlns="https://github.com/avaloniaui"
        Title="AvaloniaUI WindowTransparency Test"
        Background="Transparent"
        WindowStartupLocation="CenterScreen"
        AllowTransparency="True"
        HasSystemDecorations="False"
        Width="450"
        Height="450">
 <Border CornerRadius="20" BorderBrush="Green" BorderThickness="10" Background="Red">
   <TextBox Background="Black" Width="150" Height="30"/>
</Border>
</Window>
danwalmsley
@danwalmsley
May 24 2018 08:19
can you make the green background semi transparent too?
just so I can see if that is working?
Rayyan Tahir
@RayyanTahir
May 24 2018 08:20
sure
image.png
It gives me black border
danwalmsley
@danwalmsley
May 24 2018 08:22
@RayyanTahir did you enable WS_EX_LAYERED
this enables per pixel opacity
Rayyan Tahir
@RayyanTahir
May 24 2018 08:23
yes I did use layered style
danwalmsley
@danwalmsley
May 24 2018 08:23
hmm ok
Rayyan Tahir
@RayyanTahir
May 24 2018 08:24
@danwalmsley The reason the image shows black border is that the api only reads the RGB value of the color. The RGB part of my semi transparent border color #0100FF00 is #00FF00. If its not black then it will not be transparent (it is simply ignored)
I do however have hopes on the UpdateLayeredWindow api that @Sorien mentioned. I think I should try that now
Benedikt Schroeder
@Gillibald
May 24 2018 08:33
It seems that MockAssetLoader is causing problems sometimes. Or the way we simulate an application.
Travis just failed on Avalonia.Visuals.UnitTests.VisualTree.TransformedBoundsTests and thats no code i have touched. This passed only minutes before.
danwalmsley
@danwalmsley
May 24 2018 08:34
Yeah that is an intermittently failing test
Iv set it to run unit tests again
danwalmsley
@danwalmsley
May 24 2018 08:47
@RayyanTahir I wonder if gtk3 supports transparency because we could look at what they do on windows
Rayyan Tahir
@RayyanTahir
May 24 2018 08:51
@danwalmsley The community says to use some kind of Compositing manager to bring transparency effect in gtk3. see here
danwalmsley
@danwalmsley
May 24 2018 09:16
@RayyanTahir i was meaning what gtk does under the hood on Windows to achieve that probably somewhere in here https://github.com/GNOME/gtk/blob/ae7a6773468181b3524c12426f70749682ff0fce/gdk/win32/gdksurface-win32.c
Maybe they don't support it
I
I think update layered window is definately the right way to go
Rayyan Tahir
@RayyanTahir
May 24 2018 09:20
Yeah gtk doesn't support it there. They only implemented for opacity (0-1): https://github.com/GNOME/gtk/blob/ae7a6773468181b3524c12426f70749682ff0fce/gdk/win32/gdksurface-win32.c#L5244
Yes I'm trying UpdateLayeredWindow
Rayyan Tahir
@RayyanTahir
May 24 2018 09:25
@danwalmsley Correct me if I am wrong. My steps for this would be:
  1. Take screenshot of desktop excluding window.
  2. Cut the resulting bitmap with position and size of window to serve as background.
  3. Use that background in UpdateLayeredWindow
danwalmsley
@danwalmsley
May 24 2018 09:28
I think UpdateLayeredWindow merges alpha channel with desktop for you
As far as I can tell
So you need to find the bit of code that copies the rendered content to the window in win32 backend
And if someone has allow transparency use UpdateLayeredWindow instead
That's my understanding of it
From reading stuff
Stano Turza
@Sorien
May 24 2018 09:39
@RayyanTahir as @danwalmsley said, draw window to bitmap, fix alpha channel if needed, call UpdateLayeredWindow
Rayyan Tahir
@RayyanTahir
May 24 2018 09:40
Right, thanks
Wiesław Šoltés
@wieslawsoltes
May 24 2018 09:51
@danwalmsley Did you manage to play with Dock control?
I have made more changes and fixes yesterday.
danwalmsley
@danwalmsley
May 24 2018 09:52
@wieslawsoltes im just about to have a look
Wiesław Šoltés
@wieslawsoltes
May 24 2018 09:52
:fire:
In essence this is how I imagine how Dock control will work and will be extended
danwalmsley
@danwalmsley
May 24 2018 09:53
nice,
Wiesław Šoltés
@wieslawsoltes
May 24 2018 09:53
This is code for splitting the view into two panels
danwalmsley
@danwalmsley
May 24 2018 09:53
id like to implement this part...
image.png
Wiesław Šoltés
@wieslawsoltes
May 24 2018 09:54
This is required to implement that
danwalmsley
@danwalmsley
May 24 2018 09:54
yes
Wiesław Šoltés
@wieslawsoltes
May 24 2018 09:54
The SplitLayout method
Based on where you click, you will dock dragged view by splitting hit-tested layout
danwalmsley
@danwalmsley
May 24 2018 09:55
I can have a go at adding the preview into the adorner layer?
Here
But I want to have all possible calculation done in Model
if possible
So we can unit test
danwalmsley
@danwalmsley
May 24 2018 09:56
I guess the adorner wont need to split it to draw preview
but it will need to calculate the height and width
Wiesław Šoltés
@wieslawsoltes
May 24 2018 09:57
No
danwalmsley
@danwalmsley
May 24 2018 09:57
to draw the preview area and that function should be shared with the split method?
Wiesław Šoltés
@wieslawsoltes
May 24 2018 09:57
No really
its independent I think
You just need to draw all possible docking places
Or the place under cursor
danwalmsley
@danwalmsley
May 24 2018 09:58
what do you prefer, like on visual studio where you have a target with left, right top, bottom and fill
or just if the user drags nearer the edges for top, bottom, left and right
and if they are near center for fill?
Wiesław Šoltés
@wieslawsoltes
May 24 2018 09:59
It should depend on target
I have few different layouts
All have different functionality
And are handled differently
danwalmsley
@danwalmsley
May 24 2018 10:01
@wieslawsoltes where does the IVisual that gets added to the adorner layer get defined?
This is a bit of hack :smile:
            bool isDock = e.Data.Get(DragDataFormats.Parent) is TabStripItem item;
            if (isDock && sender is DockPanel panel)
danwalmsley
@danwalmsley
May 24 2018 10:04
ok I see now
I think I know what to do
will play around a bit :)
btw
if (isDock && sender is DockPanel panel)
            {
                RemoveAdorner();
                if (sender is IVisual visual)
                {
                    AddAdorner(visual);
                }
            }
the second if is always true isn't it?
Wiesław Šoltés
@wieslawsoltes
May 24 2018 10:09
:smile:
That was result of my hacking
Need to generalize that
My idea was to create custom controls and check for custom types here
like class TargetDockPanel : DockPanel or something similar
And use it in xaml
Currently most of the layout stuff manipulation is located in DockExtensions
danwalmsley
@danwalmsley
May 24 2018 10:31
@wieslawsoltes iv tried adding a templated control like this:
<!-- Copyright (c) Wiesław Šoltés. All rights reserved. -->
<!-- Licensed under the MIT license. See LICENSE file in the project root for full license information. -->
<Styles xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:Dock.Avalonia.Controls;assembly=Dock.Avalonia">
    <Style Selector="local|DockTarget">
        <Setter Property="Template">
            <ControlTemplate>
                <Grid Background="Green">

                </Grid>
            </ControlTemplate>
        </Setter>
    </Style>
</Styles>
then done
private void AddAdorner(IVisual visual)
        {
            var layer = AdornerLayer.GetAdornerLayer(visual);
            if (layer != null)
            {
                if (_adorner?.Parent is Panel panel)
                {
                    panel.Children.Remove(_adorner);
                    _adorner = null;
                }

                _adorner = new DockTarget
                { 
                    Width=400,
                    Height=400,
                    [AdornerLayer.AdornedElementProperty] = visual,
                };

                layer.Children.Add(_adorner);
            }
        }
but nothing appears
and OnTemplateApplied never gets called in DockTarget.cs
any ideas?
Wiesław Šoltés
@wieslawsoltes
May 24 2018 10:32
Not sure
My adorner code is from Avalonia develop tools :smile:
Maybe adorner layer is not picking the style from tree
John Källén
@uxmal
May 24 2018 10:35
Howdy all, I just opened #1610. Does anyone have the time to inform me on some basic questions?
danwalmsley
@danwalmsley
May 24 2018 10:40
@wieslawsoltes had to do
((ISetLogicalParent)_adorner).SetParent(visual as ILogical);
Wiesław Šoltés
@wieslawsoltes
May 24 2018 10:41
ok
John Källén
@uxmal
May 24 2018 10:43
I have a <Menu> with <MenuItems>. Rather than associating a separate event handler for each one of the menu items, I want to dispatch them in a single global event handler method that uses a value stored in the CommandParameter property for each menu item.
I understand that events "bubble" in Avalonia applications. How do I express that I want to capture all menu item events in the <Menu> in a single event handler?
ahopper
@ahopper
May 24 2018 10:45
@uxmal the WriteableBitmap will allow you to generate your images, list virtualization works and as for docking the discussion above might help
Wiesław Šoltés
@wieslawsoltes
May 24 2018 10:52
@uxmal Not tested, you can try this:
<Menu>
    <Menu.Styles>
        <Style Selector="MenuItem">
            <Setter Property="Command" Value="{Binding SomeMethodOrCommand}"/>
            <Setter Property="CommandParameter" Value="{Binding SomeValue}"/>
        </Style>
    </Menu.Styles>
</MenuItem>
You can also bind Command to methods in Avalonia
danwalmsley
@danwalmsley
May 24 2018 10:53
@wieslawsoltes
dock target.gif
Wiesław Šoltés
@wieslawsoltes
May 24 2018 10:53
wow
:fire:
danwalmsley
@danwalmsley
May 24 2018 10:55
will do
just need to get it to indicate which button its over that bits not working for some reason
Wiesław Šoltés
@wieslawsoltes
May 24 2018 10:56
I need to add some helper view to display dock layout in the tree
John Källén
@uxmal
May 24 2018 10:56
@wieslawsoltes : assume total newbiedom on my part. How would I bind Command to an event handler method?
Wiesław Šoltés
@wieslawsoltes
May 24 2018 10:57
Set DataContext for control/window to some view model and the bind to methods on this view model
danwalmsley
@danwalmsley
May 24 2018 10:59
@uxmal you may wish to do a WPF tutorial (with MVVM) this is an awesome tutorial serial here:
Wiesław Šoltés
@wieslawsoltes
May 24 2018 11:00
The basic idea:
public class SomeViewModel
{
    public void SomeMethodOrCommand(object param)
    {
    }
}

public class MainWindow : Window
{
    public MainWindow()
    {
        this.InitializeComponent();
        this.AttachDevTools();
        this.DataContext = new SomeViewModel();
    }

    private void InitializeComponent()
    {
        AvaloniaXamlLoader.Load(this);
    }
}
danwalmsley
@danwalmsley
May 24 2018 11:00
avalonia and wpf is a bit different from winforms, this will help you get to grips with the different way of working
@wieslawsoltes seems that stuff in adorner layer doesn't get mouse events :(
Wiesław Šoltés
@wieslawsoltes
May 24 2018 11:03
Maybe you can do similar trick as with styles
You need also somehow set correct data context
danwalmsley
@danwalmsley
May 24 2018 11:05
I remember @aelij mentioning this before
but cant find an issue or PR related to it
@grokys do you remember where the code it that prevents the adorner layer receiving mouse input?
John Källén
@uxmal
May 24 2018 11:10
@danwalmsley : thanks for the tutorial link. I will look at that now to spare you the newbie spam :)
Steven Kirk
@grokys
May 24 2018 11:17
@danwalmsley @Gillibald #1564 approved!
danwalmsley
@danwalmsley
May 24 2018 11:22
@grokys do you think its ok to change that in adorner layer?
Steven Kirk
@grokys
May 24 2018 11:22
yeah i think so
danwalmsley
@danwalmsley
May 24 2018 11:22
ok thanks
danwalmsley
@danwalmsley
May 24 2018 11:46
@grokys when I add something to adorner layer, it doesn't get its visual parent set
so hit testing crashes
what should the visual parent be or something added to adorner layer?
juepiezhongren
@juepiezhongren
May 24 2018 11:47
uno seems good
Steven Kirk
@grokys
May 24 2018 11:47
@danwalmsley oh strange, that's definitely a bug. visual parent should be adorner layer
danwalmsley
@danwalmsley
May 24 2018 11:47
is there a way to set visual parent manually?
I cant remember how to do that
for context this is what im doing right now
private void AddAdorner(IVisual visual)
        {
            var layer = AdornerLayer.GetAdornerLayer(visual);

            if (layer != null)
            {                
                if (_adorner?.Parent is Panel panel)
                {
                    layer.Children.Remove(_adorner);
                    _adorner = null;
                }

                _adorner = new DockTarget
                {                     
                    [AdornerLayer.AdornedElementProperty] = visual,
                };

                ((ISetLogicalParent)_adorner).SetParent(visual as ILogical);

                layer.Children.Add(_adorner);
            }
        }
perhaps I did something wrong there
((ISetLogicalParent)_adorner).SetParent(visual as ILogical);
maybe this wasn't needed
danwalmsley
@danwalmsley
May 24 2018 11:57
might be some interaction with drag and drop code
danwalmsley
@danwalmsley
May 24 2018 12:03
@grokys is it safe to assume when hit testing that if something isn't attached to visual tree it cant be a hit?
Steven Kirk
@grokys
May 24 2018 12:03
yes
@danwalmsley ISetLogicalParent sets the logical parent as its name suggests. it has nothing to do with the visual parent
are you SURE that children of the adorner layer aren't getting their visual parent set?
i don't see how that could be happening
danwalmsley
@danwalmsley
May 24 2018 12:07
im not sure yet
immediately after that call everything looks fine
but then drag drop code does something to hit test my newly added adorner
and its been removed from visual tree
might be because im triggering this on drag enter, adding something ontop of the control with drag enter
that maybe triggers drag leave and removes my control from visual tree
Wiesław Šoltés
@wieslawsoltes
May 24 2018 12:17
I think drag and drop is the cause
for hit-testing not working
You may need to forward mouse position to adorner from drop handler
You can get correct position using this
DropHelper.GetPosition
Add some avalonia property to adorner control and set value from drop behavior
Wiesław Šoltés
@wieslawsoltes
May 24 2018 12:22
public static readonly AvaloniaProperty PositionProperty =
    AvaloniaProperty.Register<DockTarget, Point>(nameof(Position));

public Point Position
{
    get => (Point)GetValue(PositionProperty);
    set => SetValue(PositionProperty, value);
}
var point = DropHelper.GetPosition(sender, e);
_adorner.SetValue(DockTarget.PositionProperty, point);
after adorner was added
then use Position property in DockTarget
John Källén
@uxmal
May 24 2018 12:31
Do all the XAML embedded resources have to live in an EXE or could some XAML files (and their code-behind) live in a separate assembly that is loaded dynamically?
Wiesław Šoltés
@wieslawsoltes
May 24 2018 12:31
yes you can use different assemblies
When using in xaml just provide proper assembly xmlns:external="clr-namespace:YouCustomNamespace;assembly=YourAssemblyName"
danwalmsley
@danwalmsley
May 24 2018 12:41
@wieslawsoltes yeah seems when your in drag pointer events stop
is it not possible do you think to have pointer events during drag?
if I fixed avalonia? or would that be bad?
Wiesław Šoltés
@wieslawsoltes
May 24 2018 12:47
I think it is related how Win32 handles drag and drop
@boombuler would have for info about this
AvaloniaUI/Avalonia#1556
Maybe there is a way, we have the position information in Avalonia
danwalmsley
@danwalmsley
May 24 2018 12:51
@boombuler do you think its possible to continue getting pointer events during drag drop?
danwalmsley
@danwalmsley
May 24 2018 13:05
@wieslawsoltes
its really hacky
but...
dock target working.gif
Splitwirez
@Splitwirez
May 24 2018 13:07
Apologies for the non-sequitur...I've been trying to think of a task I can use to help me get used to the differences between WPF and Avalonia, in preparation for making the switch. I happened to notice that "Platform-dependant default themes for native look&feel" is on the Plan page, and while that appears to be a bit further down the roadmap...is there any LOSS in trying to kill those two birds with one stone?
Wiesław Šoltés
@wieslawsoltes
May 24 2018 13:28
@danwalmsley Nice work!
danwalmsley
@danwalmsley
May 24 2018 13:29
@wieslawsoltes Im ready to do the splitting but not sure when exactly to do it?
shall I push what I have so far ?
generally in dock drop handler when if (bExecute) is true
danwalmsley
@danwalmsley
May 24 2018 13:30
hmm in drop behaviour I have a value for SplitDirection
Wiesław Šoltés
@wieslawsoltes
May 24 2018 13:30
it depends on drag source and draw target
danwalmsley
@danwalmsley
May 24 2018 13:30
how can I pass that value to there?
Wiesław Šoltés
@wieslawsoltes
May 24 2018 13:31
In your gif your have rectangles
depending on mouse position over dock target chose split direction
danwalmsley
@danwalmsley
May 24 2018 13:32
iv calculated that already
but I need to pass that to DockDropHandler
from DropBehavior?
Wiesław Šoltés
@wieslawsoltes
May 24 2018 13:33
yeah but not sure how
Can you recalculate this in DockDropHandler
You have access to sender there, maybe this can be used
danwalmsley
@danwalmsley
May 24 2018 13:35
ok will see
Wiesław Šoltés
@wieslawsoltes
May 24 2018 13:36
as for changes, please send PR and will see what to do :smile:
have to go now
will be available in few hours
danwalmsley
@danwalmsley
May 24 2018 14:14
almost got it splitting :)
splitting.gif
Florian
@boombuler
May 24 2018 14:33
@danwalmsley no. the drag operation is a blocking call which needs to be made from the ui thread. Only thing that might work is to accept drop in the whole window and map the drag-over events to pointer events
danwalmsley
@danwalmsley
May 24 2018 14:33
I found a workaround similar to what you suggested
that's fine then,
:)
thanks
btw do you happen to know if wpf also blocks pointer events during drag?
@wieslawsoltes a little more polish :)
Florian
@boombuler
May 24 2018 14:38
I think they will block also but not 100% sure about it. If that is not blocking, i wonder how they do it
danwalmsley
@danwalmsley
May 24 2018 14:38
polish dock.gif
danwalmsley
@danwalmsley
May 24 2018 14:47
@boombuler I get this exception a lot if my drag operation crosses desktop or file explorer
image.png
Steven Kirk
@grokys
May 24 2018 14:52
@Splitwirez no not at all! that would be a fantastic thing to implement
danwalmsley
@danwalmsley
May 24 2018 14:57
@grokys maybe we can get animations merged soon 😀
Splitwirez
@Splitwirez
May 24 2018 14:58
Animations are always good... >:3
Steven Kirk
@grokys
May 24 2018 14:58
@jmacato is considering our feedback about the syntax
danwalmsley
@danwalmsley
May 24 2018 14:59
Ok
Jumar Macato
@jmacato
May 24 2018 15:02
@danwalmsley @grokys those suggestions were logical and better than what i did :D
functionally the PR's core features are complete, save for progressbar's indefinite animation and PageTransitions (i really wanted to make those in xaml if possible but i have zero clue how to do so)

Left: Windows 7 (well, 8.1, but with a Windows 7 Visual Style)
Right: WIP Avalonia styles to match

Thoughts, so far?

Nelson Carrillo
@nc4rrillo
May 24 2018 16:49
looks great!
Jumar Macato
@jmacato
May 24 2018 16:58
@Splitwirez wow
Wiesław Šoltés
@wieslawsoltes
May 24 2018 16:59
nice
Jeremy Koritzinsky
@jkoritzinsky
May 24 2018 18:20
That looks fantastic!
danwalmsley
@danwalmsley
May 24 2018 18:26
@grokys On ItemsControl id like to add:
PseudoClasses.Set(":singleitem", collection != null && collection.Count == 1);
so that you can style stuff differently when there is only a single item in there
does that sound ok?
its very difficult to do this otherwise since we cant get collection modified events
Stano Turza
@Sorien
May 24 2018 18:31
@Splitwirez nice one, are you using WPF way or DrawFrameControl? :)
@danwalmsley css have :first-child and :last-child pseudoclasses
danwalmsley
@danwalmsley
May 24 2018 18:37
this is not to select the first or last
its just to let you know when Items.Count == 1
Stano Turza
@Sorien
May 24 2018 18:40
i think its done like this in css :first-child:nth-last-child(1)
danwalmsley
@danwalmsley
May 24 2018 18:42
@jkoritzinsky / @grokys if one of you has a spare couple of minutes, to approve #1611 its literally 2 line of code change. I would be forever grateful :)
Jeremy Koritzinsky
@jkoritzinsky
May 24 2018 18:44
Approved
danwalmsley
@danwalmsley
May 24 2018 18:44
thanks :)
@Sorien it would be nice if we supported that kind of syntax too but unfortunately doesn't seem to be there yet :)
Splitwirez
@Splitwirez
May 24 2018 18:55
Thanks for the positive feedback, folks, and sorry for the late reply
@grokys Uhhh...Avalonia styles...? (wat)
Steven Kirk
@grokys
May 24 2018 19:49
oh nice @Splitwirez!
what about avalonia styles?
Steven Kirk
@grokys
May 24 2018 19:57
hard to wrap your head around?
Splitwirez
@Splitwirez
May 24 2018 20:00
I...think I may have pinged the wrong person. [frantically blames mobile imprecision]
Steven Kirk
@grokys
May 24 2018 20:02
haha
Splitwirez
@Splitwirez
May 24 2018 20:27
Now that you mention it, though...it is kinda trippy that Avalonia styles are so similar to WPF styles, yet juuuuuuust different enough to break my usual workflow :thinking:
Splitwirez
@Splitwirez
May 24 2018 20:33
Question: Is there a default style for TabItems?
Jeremy Koritzinsky
@jkoritzinsky
May 24 2018 20:38
TabItem styling is really really funky. I'd suggest styling the TabStripItems and the Carousel directly (which you can do via selectors)
Splitwirez
@Splitwirez
May 24 2018 20:39

TabStripItem

...is that a name difference from WPF, or...?

Jeremy Koritzinsky
@jkoritzinsky
May 24 2018 21:03
Yeah I think so. Think of it as the header portion of the TabItem.
danwalmsley
@danwalmsley
May 24 2018 21:23
@grokys should psuedoclasses be inherited?
image.png
the :floating psuedoclass here only applies to the top level window
Steven Kirk
@grokys
May 24 2018 21:29
no, pseudoclasses aren't inherited
danwalmsley
@danwalmsley
May 24 2018 21:29
how does it work for itemscontrol?
ah ok
ignore that
Steven Kirk
@grokys
May 24 2018 21:30
@Splitwirez yeah they're kind of an unholy mix between WPF and CSS ;)
Splitwirez
@Splitwirez
May 24 2018 21:30
Yeah it's like you took my most and least favorite approaches to UI Styling and threw them in a Blender, lol
Steven Kirk
@grokys
May 24 2018 21:31
which one is which?
you like WPF styling?!?
Splitwirez
@Splitwirez
May 24 2018 21:31
Yes
._.
Steven Kirk
@grokys
May 24 2018 21:31
wow
Splitwirez
@Splitwirez
May 24 2018 21:31
I'm weird, I know
Steven Kirk
@grokys
May 24 2018 21:31
hehe
Splitwirez
@Splitwirez
May 24 2018 21:31
and seemingly allergic to web dev or something idk
Steven Kirk
@grokys
May 24 2018 21:32
my main problem with WPF styling is that you can't inherit styles (well you can but BasedOn is so limited that in practise I usually can't do what I want)
CSS sucks, but that's because the rules for it are so obtuse in my opinion
Splitwirez
@Splitwirez
May 24 2018 21:34
:thinking:
So far, Avalonia selectors hurt a lot less than CSS selectors...or is that just the fact that they don't have to work with half a billion different rendering engines? .-.
Steven Kirk
@grokys
May 24 2018 21:34
like float block inline etc etc, i can never remember what's what
yeah probably
and we've got no backcompat to care about
Splitwirez
@Splitwirez
May 24 2018 21:35
Would also explain why Pale Moon skinning doesn't hurt that much, in spite of using CSS...
True, backwards compatibility would, presumably, be a non-issue for you and probably the achilles' heel of my aspirations to migrate my work over to Avalonia. Maybe.
Steven Kirk
@grokys
May 24 2018 21:37
ha yeah probably
i think we probably could bolt in WPF-compatible styles if we wanted to
Splitwirez
@Splitwirez
May 24 2018 21:38
...Triggers and all? O-O
Steven Kirk
@grokys
May 24 2018 21:38
yeah probably. not sure i want to though ;)
Splitwirez
@Splitwirez
May 24 2018 21:38
...right...
Steven Kirk
@grokys
May 24 2018 21:38
WPF triggers eurgh
Splitwirez
@Splitwirez
May 24 2018 21:39
Let me guess...
Steven Kirk
@grokys
May 24 2018 21:39
how many days of my life have i lost to those things
Splitwirez
@Splitwirez
May 24 2018 21:39
T R I G G E R E D? xd
Steven Kirk
@grokys
May 24 2018 21:39
yup
Jeremy Koritzinsky
@jkoritzinsky
May 24 2018 21:39
I'd prefer not to add all of WPFs styles quirks
Btw there is a library that @wieslawsoltes wrote a while back that adds trigger and behavior support to Avalonia.
Steven Kirk
@grokys
May 24 2018 21:40
yeah. i was just thinking to myself whether we could add a wpf-compatible styling system as an extension
little known fact: our styling system is pluggable
you can register your own IStyler
Jeremy Koritzinsky
@jkoritzinsky
May 24 2018 21:40
Right I forgot about that part!
Steven Kirk
@grokys
May 24 2018 21:41
and so you could in theory write one that looks for <Style>s in resources
Splitwirez
@Splitwirez
May 24 2018 21:41
Huh...
tbh my main concern is WHERE'S BeginStoryboard!??
Jeremy Koritzinsky
@jkoritzinsky
May 24 2018 21:41
We definitely need to document all the extension points we have.
Splitwirez
@Splitwirez
May 24 2018 21:41
xd
Steven Kirk
@grokys
May 24 2018 21:41
storyboards are an animation thing
Jeremy Koritzinsky
@jkoritzinsky
May 24 2018 21:41
There's a lot that I'm sure only you know a lot about haha.
Steven Kirk
@grokys
May 24 2018 21:42
we don't really have a good um, story, for animation yet
but we should soon
Splitwirez
@Splitwirez
May 24 2018 21:42
...oh
welp
Steven Kirk
@grokys
May 24 2018 21:42
AvaloniaUI/Avalonia#1461
Splitwirez
@Splitwirez
May 24 2018 21:42
[extremely patient waiting noises]
Steven Kirk
@grokys
May 24 2018 21:43
but you'll be displeased to know it's based more on CSS than WPF
Splitwirez
@Splitwirez
May 24 2018 21:43
Can it do all the same things, atleast...? ._.
Steven Kirk
@grokys
May 24 2018 21:43
because if there's anything worse than WPF's styling, it's WPF's animation
probably not yet
Jeremy Koritzinsky
@jkoritzinsky
May 24 2018 21:43
It should be able to do most of the same things.
Steven Kirk
@grokys
May 24 2018 21:44
i much prefer the (maybe) syntax to WPF's
<Animation Duration="0:0:0.5">
  <KeyFrame Cue="0%">
    <Setter Property="Opacity" Value="0"/>
    <Setter Property="ScaleTransform.Scale" Value="0.1"/>
    <Setter Property="RotateTransform.Angle" Value="30"/>
  </KeyFrame>
  <KeyFrame Cue="50%">
    <Setter Property="RotateTransform.Angle" Value="-10"/>
  </KeyFrame>
  <KeyFrame Cue="70%">
    <Setter Property="RotateTransform.Angle" Value="3"/>
  </KeyFrame>
  <KeyFrame Cue="100%">
    <Setter Property="Opacity" Value="1"/>
    <Setter Property="ScaleTransform.Scale" Value="1"/>
  </KeyFrame>
</Animation>
Splitwirez
@Splitwirez
May 24 2018 21:45
So in other words, I'd still be able to https://i.imgur.com/l3PDHb1.gifv and https://www.youtube.com/watch?v=0xB53Xk5QhI with Avalonia...?
Thanks for only embedding the video, Gitter >.>
Steven Kirk
@grokys
May 24 2018 21:45
yeah i'm hoping so
Splitwirez
@Splitwirez
May 24 2018 21:46
cool and good
:D
Steven Kirk
@grokys
May 24 2018 21:46
2 main things I want to be able to do that WPF can't: animate a control from a fixed size to its natural size
it's CRAZY you can't do that in WPF
Splitwirez
@Splitwirez
May 24 2018 21:46
OH MY GOD YES PLEASE
Steven Kirk
@grokys
May 24 2018 21:46
and 2 animate a control changing position
and maybe 3: animate showing/hiding without anything other than setting the control visibility
Splitwirez
@Splitwirez
May 24 2018 21:47
EVEN MORE "OH MY GOD YES PLEASE"
Steven Kirk
@grokys
May 24 2018 21:47
THREE main things i want to be able to do
yeah, so it might take us a little while, but things are getting there
Splitwirez
@Splitwirez
May 24 2018 21:48
[continued extremely patient waiting noises]
Also...not really related to animation, but another thing WPF can't really do for some stupid reason: Calling DwmEnableBlurBehindWindow on a Window with AllowsTransparency set to true without breaking all the things
Steven Kirk
@grokys
May 24 2018 21:48
i think someone is looking into transparency right now
Jeremy Koritzinsky
@jkoritzinsky
May 24 2018 21:48
Yeah there was a conversation earlier today trying to figure it out.
Please don't repeat this abomination, lol
Steven Kirk
@grokys
May 24 2018 21:50
@jkoritzinsky AvaloniaUI/Avalonia#1612 -- i think this is a big moment!
if CI passes that is
i'm working on some more portable.xaml fixes, so would be good if we can use vanilla portable.xaml as a starting point
Jeremy Koritzinsky
@jkoritzinsky
May 24 2018 21:56
Sounds good to me! I'll take a look when I have some time to review. Hopefully at some point we'll even be able to use Portable.xaml as a package instead of a submodule!
Steven Kirk
@grokys
May 24 2018 22:01
yeah hopefully
@Splitwirez it sounds like you've done a fair bit of animation - it would be good if you could take a look at AvaloniaUI/Avalonia#1461 and give some feedback!
Splitwirez
@Splitwirez
May 24 2018 22:02
...with WPF, yes. I've also worked with UTFWin animations a bit, but that's a proprietary UI engine nobody outside of EA is supposed to know exists, so meh ._.
Steven Kirk
@grokys
May 24 2018 22:16
actually i think the animations PR is pretty much ready to be merged
Splitwirez
@Splitwirez
May 24 2018 22:16
O:
Nelson Carrillo
@nc4rrillo
May 24 2018 22:16
merge it ! :)
Steven Kirk
@grokys
May 24 2018 22:16
i don't like the fact that animations have to use <DoubleSetter> etc rather than <Setter>
Splitwirez
@Splitwirez
May 24 2018 22:16
wut
Steven Kirk
@grokys
May 24 2018 22:16
but AvaloniaUI/Avalonia#1594 should be able to fix that for us
@jkoritzinsky could we move Avalonia.Styling to be available to Avalonia.Animation in that PR :point_up:
but @Splitwirez i'd appreciate your :eyes: on it if you have a moment ;)
if only to let us know what we're missing
Splitwirez
@Splitwirez
May 24 2018 22:18
...uhh...kinda hard to say without being able to mess around with it myself...wait is that what's happening now?
Steven Kirk
@grokys
May 24 2018 22:19
heh it could be!
you don't get to show up here sounding like you know something about something and not get roped into something
Splitwirez
@Splitwirez
May 24 2018 22:23
Understandable. And now for the part where I fail miserably at understanding how to GitHub ._.
Jeremy Koritzinsky
@jkoritzinsky
May 24 2018 22:28
@grokys I'll move it back haha!
Steven Kirk
@grokys
May 24 2018 22:29
was it there originally?
Jeremy Koritzinsky
@jkoritzinsky
May 24 2018 22:42
Yeah in my prototyping. I thought I left that in the commit history but i must have rebased it away
Jumar Macato
@jmacato
May 24 2018 23:02
@Splitwirez i saw your example vids (good looking app btw, i dig Longhorn-era UI so much as Metro haha)
i didn't see anything that id fundamentally impossible for the current state of our animations engine
that is*
Splitwirez
@Splitwirez
May 24 2018 23:03
Thank. That's very reassuring, as what I showed was some of the stuff I'm hoping to move to Avalonia...
Jumar Macato
@jmacato
May 24 2018 23:04
our approach has been rather radical when it comes to styling and animations
Splitwirez
@Splitwirez
May 24 2018 23:05
So...more than just CSS retrobolted onto WPF?
Jumar Macato
@jmacato
May 24 2018 23:05
it's more like css-inspired? it's all still xaml at the end of the day
Splitwirez
@Splitwirez
May 24 2018 23:05
Well...yeah...
Jumar Macato
@jmacato
May 24 2018 23:06
i worked with wpf animations and i never really liked the verbosity of it
Splitwirez
@Splitwirez
May 24 2018 23:06
I will admit that I do find that part a bit annoying
Jumar Macato
@jmacato
May 24 2018 23:07
but it was so powerful, too powerful that it honestly drags the performance of the app somewhat
Splitwirez
@Splitwirez
May 24 2018 23:08
...oh is that why that happens?
Jumar Macato
@jmacato
May 24 2018 23:09
yes, but i don't have any scientific benchmarks to prove my point so take it with a grain of salt ;)
it's just a hunch haha
Splitwirez
@Splitwirez
May 24 2018 23:10
Well it does make sense...
Jumar Macato
@jmacato
May 24 2018 23:15
@Splitwirez btw how many years Start9 has been going? i swear i saw it in some windows customization sites on idk how many years ago
or maybe i confused it with something else, idk :laughing:
Splitwirez
@Splitwirez
May 24 2018 23:16
Development started in March 2017, as nothing more than a Start menu replacement that went against the grain of what Start menu replacements were supposed to do. In August/September (IIRC) 2017, now working with a second developer far more capable in backend stuff than myself, we decided we had a shot at changing the face of Windows customization forever...and decided to take it. And that's how Start9 became the modular shell thing it aims to be now :P
Jumar Macato
@jmacato
May 24 2018 23:17
wow, great respect for your dedication & hardwork
Splitwirez
@Splitwirez
May 24 2018 23:18

Thanks...we've still got a long way to go, and tbh the setback moving to Avalonia would create, while temporary, still has me worried.

I still want to go through with it though, if possible, preferably before our first preview release.

Jumar Macato
@jmacato
May 24 2018 23:19
hmm, it's probably best if you can wait for the recent changes to be merged
but feel free to determine the viability of this framework by prototyping stuff
Splitwirez
@Splitwirez
May 24 2018 23:19
...before migrating or releasing the preview?
(and I have been)
Jumar Macato
@jmacato
May 24 2018 23:19
before migrating :)
i'd say maintain two versions of Start9 for the time being, WPF as stable target and Avalonia for you know, catching things up
but it's up to you pal
Jeremy Koritzinsky
@jkoritzinsky
May 24 2018 23:21
@grokys @danwalmsley Looks like master is broken on Linux.
Splitwirez
@Splitwirez
May 24 2018 23:22
Fair point. Thanks for the advice.
Jumar Macato
@jmacato
May 24 2018 23:22
@Splitwirez btw, any feedback for #1461 will be most appreciated
Steven Kirk
@grokys
May 24 2018 23:22
@jkoritzinsky hmm strange, the PR that broke it passed
Jumar Macato
@jmacato
May 24 2018 23:23
@Splitwirez i'd like to hear as much opinions as possible before finalizing it to sir @grokys
Splitwirez
@Splitwirez
May 24 2018 23:24

I would be happy to try to provide some feedback, but...as I said above, I'd kinda need to try it out myself and mess around before I can say anything meaningful...

...then there was that other link where I'm...not even sure what's happening because how to GitHub .-.

Jumar Macato
@jmacato
May 24 2018 23:25
Hahah it's alright :laughing:
Currently we only have two setters: DoubleSetters and TransformSetters
i'd like to make a special setter called... Setter that will enable the syntax described earlier
Splitwirez
@Splitwirez
May 24 2018 23:26
Wait hold up...is this in the nightly builds?
Jumar Macato
@jmacato
May 24 2018 23:27
on my fork (jmacato/Avalonia branch 'wip-animations')
wait let me send a link
Splitwirez
@Splitwirez
May 24 2018 23:27
Oh th--
I'm an idiot ._.
Splitwirez
@Splitwirez
May 24 2018 23:27
...or not?
Jumar Macato
@jmacato
May 24 2018 23:29
play around with samples/RenderTest project first :) oh when cloning, make sure it's recursive to fetch the submodules
Jeremy Koritzinsky
@jkoritzinsky
May 24 2018 23:29
@grokys I think it might be a race condition with the AvaloniaLocator services. Do we run tests in that assembly in parallel?
Splitwirez
@Splitwirez
May 24 2018 23:30
...where is the recursive option?
Jumar Macato
@jmacato
May 24 2018 23:30
hmm here's the git command: git clone https://github.com/jmacato/Avalonia/ -b wip-animations --recursive
just copypasta that to your console and it'll clone for you : )
Steven Kirk
@grokys
May 24 2018 23:31
@jkoritzinsky we shouldn't be. let me re-run that build and lets see if it passes
ok, i gotta go to bed now. night all!