These are chat archives for AvaloniaUI/Avalonia

23rd
Nov 2018
braca
@braca
Nov 23 2018 12:00
Any style expert around? :P
Let's say that I want to customize a control to have some custom behavior, but I want it to have the same style as the base class.
Is there anyway to reuse the base class style?
ahopper
@ahopper
Nov 23 2018 12:08
look at StyleKey near the top of http://avaloniaui.net/docs/styles/selectors
braca
@braca
Nov 23 2018 12:09
@ahopper :O how could I miss that! thanks
nicolasr75
@nicolasr75
Nov 23 2018 12:27
Is there any event that can be used when a window is shown (rendered)? I want to use this to make the window fullscreen. I don't mean Maximized! I have a button that already makes the window fullscreen but now I want to apply that directly after the window is shown for the first time. WPF seems to have OnContentRendered which can be overridden but I don't find anything like that in Avalonia.
Benedikt Schroeder
@Gillibald
Nov 23 2018 13:11
You could override the Render method of the control I guess but that is called quite frequently. Not ideal.
Benedikt Schroeder
@Gillibald
Nov 23 2018 13:37
Why don't you set the window to maximized before showing it?
Steven Kirk
@grokys
Nov 23 2018 13:48
@nicolasr75 you could subscribe to the IsVisible property: window.GetObservable(Window.IsVisible).Subscribe(x => if (x) { /* stuff here */ });
but yeah we should really have Shown and Hidden events or something
nicolasr75
@nicolasr75
Nov 23 2018 14:19
@Gillibald I think I could use Render with a initialization flag. Setting window to maximized does not work. As I wrote: I need a fullscreen window, not a maximized window! But I have figured out that part (at least for Linux). This is a Kiosk software...
@grokys Thanks, that looks good. Shown/Hidden events would be very comfortable of course.
Benedikt Schroeder
@Gillibald
Nov 23 2018 14:25
Maximized without decorations should work.
HasSystemDecorations="False"
With WPF you would set WindowStyle to None
nicolasr75
@nicolasr75
Nov 23 2018 14:50
@Gillibald You are right, that should work on Windows. Any idea if this is implemented for Linux? In my Linux specific codes I am using the wmctrl package but that is something that would need to be installed explicitly. Without wmctrl I guess the Window will not hide the system tray / task bar. I will do some tests...
danwalmsley
@danwalmsley
Nov 23 2018 15:53
@grokys @kekekeks I found a better way to do SystemDecorations="False" on win32
currently if we do that then we are not compatible with windows 10 / 8 / 7 feature where you can drag to an edge and have it snap your window
or press window + arrow key to rearrange your view
undecorated-window-frame.gif
see #2128 for details on how its done
Nikita Tsukanov
@kekekeks
Nov 23 2018 15:59
So you are basically making a zero-sized non-client area
You need to set minimize/maximize/resize flags
That are part of WS_OVERLAPPEDWINDOW
Individually
They also control the window menu
Which is triggered by Ctrl+RightClick on taskbar
Or Alt
Don't quite remember
It can also be triggered by some hotkey when window is opened, I think
danwalmsley
@danwalmsley
Nov 23 2018 16:05
@kekekeks I need to disable them in WS_OVERLAPPEDWINDOW?
danwalmsley
@danwalmsley
Nov 23 2018 16:21
@kekekeks is this the menu you refer to?
image.png
Nikita Tsukanov
@kekekeks
Nov 23 2018 16:39
Shift+right click
Ontaskbar item
WS_OVERLAPPEDWINDOW is actually WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX
It's just a shortcut combination of these flags
erutovic
@erutovic
Nov 23 2018 16:56
Hi, I am Manu from Montréal (Canada).
I have been recently following Avalonia and Core2D. Great job!
I am working in a software company developing a CAD tool for electrical engineering. The technology stack is currently WPF/Direct2D/C++ . We are looking for a consultant to help us to port our tool to Avalonia (or at least give it a try).
Let me know if any of you is interested. You can contact me here, by email (manu@upsim.tech) or on LinkedIn https://www.linkedin.com/in/rutovic/ .
Thanks! (and sorry if this is not the right place for this kind of communication).
Steven Kirk
@grokys
Nov 23 2018 17:45
thanks @erutovic - it definitely is the right place!
Benedikt Schroeder
@Gillibald
Nov 23 2018 17:50
AvaloniaUI/Avalonia#1950 now uses the latest preview of SkiaSharp and it looks like just on unit test is failing after the upgrade.
It also uses the new Linux natives package so we don't need to maintain that anymore
MonkAlex
@MonkAlex
Nov 23 2018 18:34
devtools (F12) breaked in 0.7 release?
Nikita Tsukanov
@kekekeks
Nov 23 2018 18:35
Definitely worked for me yesterday
Might behave in a weird way on Windows with .NET Core 2.1+
MonkAlex
@MonkAlex
Nov 23 2018 18:38
Its failed on f12 and cannot be catched in VS
jp2masa
@jp2masa
Nov 23 2018 18:39
I currently target netcoreapp2.0 to be able to use the dev tools...
Jeremy Koritzinsky
@jkoritzinsky
Nov 23 2018 18:40
Yeah we had to change to ctrl+f12
F12 when the debugger attached causes a kernel exception to allow you to break debug at any point.
MonkAlex
@MonkAlex
Nov 23 2018 18:40
My app failed on 2.0, but netcore team not fix bug in old version's
So, i can try 2.0, thanks
MonkAlex
@MonkAlex
Nov 23 2018 18:52
Has strange bug with TextBlock - his property not showed in devtool, he trim text content
the same TextBlock in the same grid work well
etykieta-woluminu
@etykieta-woluminu
Nov 23 2018 19:20
Hello! What is the correct syntax to bind to an event from the view? I could not find anything in the documentation.
I tried things like PointerPressed="Click", PointerPressed="{Binding Click}", where Click was either a method or a command object.
Unfortunately, each of these attempts throws an exception at runtime.
Nikita Tsukanov
@kekekeks
Nov 23 2018 19:22
What exception exactly? I've thought the first one is already supported by Portable.Xaml
Check if you have a proper signature for your "Click" method
Also make sure that it's defined in code-behind
etykieta-woluminu
@etykieta-woluminu
Nov 23 2018 19:23
I defined it in the view model. That might be a problem.
etykieta-woluminu
@etykieta-woluminu
Nov 23 2018 19:32
Ok, thanks. It works from the code behind.
I guess it is not possible to bind to the view model at the moment?
Jeremy Koritzinsky
@jkoritzinsky
Nov 23 2018 19:34
You'd have to use the Avalonia Behaviors package to use commands with events. We have binding support for commands (ie when the type of the property is ICommand)
etykieta-woluminu
@etykieta-woluminu
Nov 23 2018 19:39
@jkoritzinsky thanks, I will look into it.
Steven Kirk
@grokys
Nov 23 2018 19:44
i wonder how easy it would be to allow binding to events on the view model?
<Button Click="{Binding ButtonClicked}"> would be cool
nicolasr75
@nicolasr75
Nov 23 2018 19:47

I followed your discussion about fullscreen windows without covering the taskbar January 2017. As it seems the default behavior is now to not cover the taskbar and you agreed on waiting until someone asks for real fullscreen windows. Here I am! ;-) I need real fullscreen windows for Kiosk apps on Raspberry PIs. Should I create a Github issue? In WPF it's enough to set WindowState and WindowStyle in XAML. I should point out that it would also be helpful if one can switch between fullscreen and normal mode for maintenance. In native Win32 apps it requires an explicit call to SetWindowPos to resize the already running app accordingly in addition to maximizing and removing the window frame:

SetWindowPos(this->Handle, HWND_TOP, 0, 0, Screen->Monitors[0]->Width, Screen->Monitors[0]->Height, SWP_SHOWWINDOW);

On Linux I use the wmctrl package which even works with existing Avalonia app. On Windows I have nothing comparable for Avalonia apps :-(

danwalmsley
@danwalmsley
Nov 23 2018 19:49
@nicolasr75 I could possibly do it, soon, but it depends on how you think it should be implemented since I dont think we have WindowStyle like WPF
perhaps we could add a WindowState like Minimized, Maximized, FullScreen
see what the others think about this?
ahopper
@ahopper
Nov 23 2018 19:53
@grokys passing view related event args to the view model and dealing with 'handled' worries me, wrapping events as commands is often useful though
Steven Kirk
@grokys
Nov 23 2018 19:54
yeah, but if we just said that i could only call methods with no parameters that might work for the common case
or commands too
ahopper
@ahopper
Nov 23 2018 19:55
yep and maybe a command parameter
nicolasr75
@nicolasr75
Nov 23 2018 20:03
@danwalmsley I personally like the idea of adding FullScreen to WindowState. I never found the way it works in Win32 very intuitive and one can see by the numerous questions on the Internet that I'm not the only one. I am not sure, however, if it's good to deviate from Win32/WPF. Then again, have a look at QT https://doc.qt.io/archives/qtjambi-4.5.2_01/com/trolltech/qt/core/Qt.WindowState.html
ahopper
@ahopper
Nov 23 2018 20:07
could a converter be used to bind event args to a method/command call
danwalmsley
@danwalmsley
Nov 23 2018 20:08
i know the osx backend could be implemented that way easily too
dont know enough about GTK though but hopefully that could work too
nicolasr75
@nicolasr75
Nov 23 2018 20:25
@danwalmsley GTK also seems to handle FullScreen complementary to Maximized https://developer.gnome.org/gtk3/stable/GtkWindow.html
danwalmsley
@danwalmsley
Nov 23 2018 21:02
@nicolasr75 are you trying to make some kind of kiosk mode app?
nicolasr75
@nicolasr75
Nov 23 2018 21:19
Yes, that's exactly my goal and I guess many people would find that useful for Raspberry PI, Arduino etc... As I mentioned above: it's nice to have the app go fullscreen on startup but even better it would be toggleable. Imagine you have the app running fullscreen and for whatever reason want to access the underlying system tools. On Linux I currently use a special button that toggles fullscreen mode via the wmctrl package. It would be great if this would work out of the box for all systems with, f.e. WindowState=FullScreen vs. WindowState=Normal and no need for installing an external package.
jp2masa
@jp2masa
Nov 23 2018 21:31
:+1: I was looking for that feature a few weeks ago as well