These are chat archives for AvaloniaUI/Avalonia

18th
Aug 2017
Nikita Tsukanov
@kekekeks
Aug 18 2017 06:52
Ehm, for layers?
And for patterns?
Recording drawing commands instead of actually drawing kinda kills the purpose of RenderTargetBitmap
Matthijs ter Woord
@mterwoord
Aug 18 2017 07:24
@grokys You have pointers for me where to find the code that does the actual template resoluiton? (ie, responds to the classes chnages
you can see in that method that it applies the setters for the style
Matthijs ter Woord
@mterwoord
Aug 18 2017 07:54
first fighting to get a sample project with just a button going..
:(
what is the team's opinion in self-explaining error messages for errors that are most-likely dev mistakes?
Matthijs ter Woord
@mterwoord
Aug 18 2017 08:56
@grokys It's not in the code: I made a test project which does not use the default templates, and that one works as expected :)
Steven Kirk
@grokys
Aug 18 2017 08:56
yeah we definitely need to improve our errors in places
Matthijs ter Woord
@mterwoord
Aug 18 2017 08:56
just was bit by loading xaml in the ctor of the app
how about changing that error, that, if an app is being loaded, it says that that should nto be do ne in ctor?
Steven Kirk
@grokys
Aug 18 2017 08:57
please, add an issue with the exact problem!
Matthijs ter Woord
@mterwoord
Aug 18 2017 08:58
do you prefer an issue or a pr?
Steven Kirk
@grokys
Aug 18 2017 08:58
probably an issue first so we can discuss the behavior
Matthijs ter Woord
@mterwoord
Aug 18 2017 08:58
ok
#1104
danwalmsley
@danwalmsley
Aug 18 2017 09:02
@grokys if you have a few minutes could you have a look at PR #1103 ?
Steven Kirk
@grokys
Aug 18 2017 09:02
sorry, not going to have time for a bit
like i said, i'm taking a bit of a break from avalonia atm
danwalmsley
@danwalmsley
Aug 18 2017 09:03
ok no worries
Steven Kirk
@grokys
Aug 18 2017 09:04
happy to point people in the right direction here, but i really don't have time right now for much more
hopefully @kekekeks and @jkoritzinsky might have time to review stuff
well tbh i probably do have time if i need to
i just dread having to open VS2017
Matthijs ter Woord
@mterwoord
Aug 18 2017 10:03
would tests with real controls be accepted?
Nikita Tsukanov
@kekekeks
Aug 18 2017 10:19

i just dread having to open VS2017

Use Rider!

danwalmsley
@danwalmsley
Aug 18 2017 10:51
@kekekeks I'm I doing something wrong here...
<Border CornerRadius="10" BorderBrush="#3E3E42" BorderThickness="2" Margin="20">
    <Grid Background="Red">

    </Grid>
  </Border>
is producing...
image.png
Nikita Tsukanov
@kekekeks
Aug 18 2017 10:52
I guess clipping region wasn't set or something
danwalmsley
@danwalmsley
Aug 18 2017 10:52
so its a bug
Nikita Tsukanov
@kekekeks
Aug 18 2017 10:52
Yep
danwalmsley
@danwalmsley
Aug 18 2017 10:53
if you know where I need to look I will try and fix it
Nikita Tsukanov
@kekekeks
Aug 18 2017 10:53
Somewhere in the rendering pipeline
danwalmsley
@danwalmsley
Aug 18 2017 10:53
oh
not a simple one to find then I guess
Nikita Tsukanov
@kekekeks
Aug 18 2017 10:53
Does it work properly with ImmediateRenderer?
Hm
I guess it doesn't
danwalmsley
@danwalmsley
Aug 18 2017 10:54
no
See? Here it sets clip rectangle
The problem is that it's supposed to be a rounded corner rectangle...
danwalmsley
@danwalmsley
Aug 18 2017 10:56
is there another property other than bounds that contains the correct clip?
Nikita Tsukanov
@kekekeks
Aug 18 2017 10:56
@grokys I guess we didn't supported this anytime in the past, did we?
Yep, you can set geometry clip as a workaround
danwalmsley
@danwalmsley
Aug 18 2017 10:58
in my code or in avalonia?
Nikita Tsukanov
@kekekeks
Aug 18 2017 10:58
Or, as a better measure
Set Background on Border itself
In your code
danwalmsley
@danwalmsley
Aug 18 2017 10:58
I'm only setting background to demo the issue
Nikita Tsukanov
@kekekeks
Aug 18 2017 10:59
Ah, ok
danwalmsley
@danwalmsley
Aug 18 2017 10:59
normally there is content control
Nikita Tsukanov
@kekekeks
Aug 18 2017 10:59
That's definitely a bug though
And I'm not sure how it should be correctly implemented
Since WPF has the same behavior
danwalmsley
@danwalmsley
Aug 18 2017 11:01
wpf has the same bug?
danwalmsley
@danwalmsley
Aug 18 2017 11:01
interesting
Nikita Tsukanov
@kekekeks
Aug 18 2017 11:01
I guess it's not really a bug
Just a limitation of the rendering system
danwalmsley
@danwalmsley
Aug 18 2017 11:02
fair enough
actually on render test
Nikita Tsukanov
@kekekeks
Aug 18 2017 11:02
But we should support that, I think
danwalmsley
@danwalmsley
Aug 18 2017 11:02
there is a really complex clipping
is it just I should be doing something like that instead?
or that border should do that
Nikita Tsukanov
@kekekeks
Aug 18 2017 11:02
Border should produce a proper clip region automatically or something
If CornerRadius property isn't zero
danwalmsley
@danwalmsley
Aug 18 2017 11:03
that render test is using
<Border Name="clipped"
            Background="Yellow"
            Width="100"
            Height="100"
            Clip="M 58.625 0.07421875 C 50.305778 0.26687364 42.411858 7.0346526 41.806641 15.595703 C 42.446442 22.063923 39.707425 13.710754 36.982422 12.683594 C 29.348395 6.1821635 16.419398 8.4359222 11.480469 17.195312 C 6.0935256 25.476803 9.8118851 37.71125 18.8125 41.6875 C 9.1554771 40.62945 -0.070876925 49.146842 0.21679688 58.857422 C 0.21545578 60.872512 0.56758794 62.88911 1.2617188 64.78125 C 4.3821886 74.16708 16.298268 78.921772 25.03125 74.326172 C 28.266843 72.062552 26.298191 74.214838 25.414062 76.398438 C 21.407348 85.589198 27.295992 97.294293 37.097656 99.501953 C 46.864883 102.3541 57.82177 94.726518 58.539062 84.580078 C 58.142158 79.498998 59.307538 83.392694 61.207031 85.433594 C 67.532324 93.056874 80.440232 93.192029 86.882812 85.630859 C 93.836392 78.456939 92.396838 65.538666 84.115234 60.009766 C 79.783641 57.904836 83.569793 58.802369 86.375 58.193359 C 96.383335 56.457569 102.87506 44.824101 99.083984 35.394531 C 95.963498 26.008711 84.047451 21.254079 75.314453 25.849609 C 72.078834 28.113269 74.047517 25.960974 74.931641 23.777344 C 78.93827 14.586564 73.049722 2.8815081 63.248047 0.67382812 C 61.721916 0.22817968 60.165597 0.038541919 58.625 0.07421875 z ">
so perhaps border itself should just be setting a clip underneath
danwalmsley
@danwalmsley
Aug 18 2017 11:04
like an internal grid with a corner radius clip
btw what would I google to understand the syntax for clip?
Nikita Tsukanov
@kekekeks
Aug 18 2017 11:05
With WPF people are using another Border element as OpacityMask
It should also work with Avalonia, I think
Steven Kirk
@grokys
Aug 18 2017 11:06
sorry, i don't understand - what is the full code? what is setting the clip rectangle?
Steven Kirk
@grokys
Aug 18 2017 11:07
ah, sorry i think i understand
Nikita Tsukanov
@kekekeks
Aug 18 2017 11:07
@grokys Border uses rectangle clipping instead of round rectangle clip mask
Steven Kirk
@grokys
Aug 18 2017 11:07
border doesn't do clipping does it?
Nikita Tsukanov
@kekekeks
Aug 18 2017 11:08
It can if you set ClipToBounds
Steven Kirk
@grokys
Aug 18 2017 11:08
right, but that's clip to Bounds
Nikita Tsukanov
@kekekeks
Aug 18 2017 11:08
But it will use bounds
Steven Kirk
@grokys
Aug 18 2017 11:08
right
Nikita Tsukanov
@kekekeks
Aug 18 2017 11:08
We need a way to clip to proper region
Steven Kirk
@grokys
Aug 18 2017 11:08
yeah, that's a separate issue then, i think the current behavior is correct
Nikita Tsukanov
@kekekeks
Aug 18 2017 11:09
Yep, renderer is OK
Border behaves like it does in WPF
It's just counterintuitive
Steven Kirk
@grokys
Aug 18 2017 11:09
yeah
danwalmsley
@danwalmsley
Aug 18 2017 11:10
ok so we are saying we should improve our border to apply a clip for corner radius?
Steven Kirk
@grokys
Aug 18 2017 11:10
it's something we can fix, but i'd say it's low priority as all other XAML frameworks behave like this
danwalmsley
@danwalmsley
Aug 18 2017 11:11
ok I'm happy to fix it
unless its better of as workaround in user code
?
Steven Kirk
@grokys
Aug 18 2017 11:11
for the moment better to work around it in user code i think
i'm not sure how a good solution would look
Matthijs ter Woord
@mterwoord
Aug 18 2017 11:22
is it possible to access items in the active templates, from a control?
Matthijs ter Woord
@mterwoord
Aug 18 2017 11:30
similar. i was hoping to abuse it for my styling/button issue....
Matthijs ter Woord
@mterwoord
Aug 18 2017 12:33
How about adding CornerRadius property on button?
Matthijs ter Woord
@mterwoord
Aug 18 2017 15:08
I would od the changes myself, but i like todiscuss here first.
Steven Kirk
@grokys
Aug 18 2017 15:42
i don't think a CornerRadius on button makes much sense tbh
that sort of thing is decided by the theme, the user shouldn't be overriding it for most themes i imagine
Matthijs ter Woord
@mterwoord
Aug 18 2017 15:45
doesn't the same thing count for almost any look related property (background, border, etc)
i keep missing questionmarks.. :(
Steven Kirk
@grokys
Aug 18 2017 15:52
yeah kind of i guess, but then most controls with those properties actually have a background or a border
but a button for a theme might not have rounded corners
Matthijs ter Woord
@mterwoord
Aug 18 2017 15:53
true
hmm, in my case i might actually end up with custom theme anyway..
:(
sure, but for another theme it might not have a background, but just a rounded border.. but i get your point, hard to draw the line perfectly, so have to draw it somewhere
i pretty much got lost find the issue with the button stylinhg.. :(
Steven Kirk
@grokys
Aug 18 2017 19:33
ok, i've got a few hours free - do i dare fire up VS2017?
Nikita Tsukanov
@kekekeks
Aug 18 2017 22:54
@grokys Rider is amazing
It loads our solution in ~3 minutes (with "warm" caches, cold load with nuget restore was somewhat like ~10 min)
No hangs, no crashes, no freezes
Build time is significantly faster
BTW
We can render stuff over TCP/IP now
That will allow to have previewer support on OSX/Linux later
            var transport = new BsonTcpTransport();
            transport.Listen(IPAddress.Loopback, port, sc =>
            {
                Dispatcher.UIThread.InvokeAsync(() =>
                {
                    new RemoteServer(sc).Content = new MainView();
                });
            });

            var cts = new CancellationTokenSource();
            transport.Connect(IPAddress.Loopback, port).ContinueWith(t =>
            {
                Dispatcher.UIThread.InvokeAsync(() =>
                {
                    var window = new Window()
                    {
                        Content = new RemoteWidget(t.Result)
                    };
                    window.Closed += delegate { cts.Cancel(); };
                    window.Show();
                });
            });
            Dispatcher.UIThread.MainLoop(cts.Token);
Just as simple as that
No keyboard/mouse input for now, only rendering