These are chat archives for AvaloniaUI/Avalonia

25th
Dec 2018
Valters
@FaithLV
Dec 25 2018 07:20
Hey, is there anything like Pages in WPF? Or do I need to do some magic with Carousels?
danwalmsley
@danwalmsley
Dec 25 2018 08:11
ContentControl with datatemplates?
Nikita Tsukanov
@kekekeks
Dec 25 2018 09:04
@jkoritzinsky Designer currently doesn't try to load the codebehind
Since I haven't figured a way to suppress/replace AvaloniaXamlLoader.Load(this)
We could probably try to analyze the stack trace
Or check the type of the passed this instance
If we have x:Class it should exactly match
That would allow to preview the view that recursively uses itself
CtrlShiftEscape
@CtrlShiftEscape
Dec 25 2018 14:38
How to override WndProc?
CtrlShiftEscape
@CtrlShiftEscape
Dec 25 2018 14:43
And how to make my titlebar open the default context menu?
Nikita Tsukanov
@kekekeks
Dec 25 2018 16:45

How to override WndProc?

We don't provide the means to do that

You can override GWL_WNDPROC using SetWindowLong
Nikita Tsukanov
@kekekeks
Dec 25 2018 16:50

And how to make my titlebar open the default context menu?

DefWindowProc with WM_NCRBUTTONDOWN (or WM_NCRBUTTONUP, don't quite remember) with HTCAPTION

CtrlShiftEscape
@CtrlShiftEscape
Dec 25 2018 17:35
But UnmanagedMethods is internal
Nikita Tsukanov
@kekekeks
Dec 25 2018 17:36
We usually don't expose platform-specific APIs
Valters
@FaithLV
Dec 25 2018 17:51
Anybody got any luck getting with getting AutoFac working with window creation? I'd like to setup a system where I could inject instances to MainWindow constructor, but manually registering MainWindow throws me exception that IWindowingPlatform is not registered. Is there a way to register platform without using AppBuilder or integrate it with AutoFac?
Nikita Tsukanov
@kekekeks
Dec 25 2018 17:57
        [STAThread]
        static void Main(string[] args)
        {
                BuildAvaloniaApp().Start(AppMain, args);
        }

        public static AppBuilder BuildAvaloniaApp()
                => AppBuilder.Configure<App>().UsePlatformDetect().UseSkia().UseReactiveUI();

        static void AppMain(Application app, string[] args)
        {
            // You can configure AutoFac here
            app.Run(new MainWindow());
        }
This way of initializing the app is available in nightly builds
With 0.7 you can do this:
        [STAThread]
        static void Main(string[] args)
        {
                AppMain(BuildAvaloniaApp().SetupWithoutStarting().Instance, args);
        }

        public static AppBuilder BuildAvaloniaApp()
                => AppBuilder.Configure<App>().UsePlatformDetect().UseSkia().UseReactiveUI();

        static void AppMain(Application app, string[] args)
        {
            // You can configure AutoFac here
            app.Run(new MainWindow());
        }
Valters
@FaithLV
Dec 25 2018 17:59
.Instance
thanks!
will try
Valters
@FaithLV
Dec 25 2018 18:40
there's no way to inject dependencies into MainWindow, right?
Nikita Tsukanov
@kekekeks
Dec 25 2018 19:51
You can inject dependencies (or do whatever you want with constructor) as long as Avalonia itself is initialized at that point
The exception you are seeing is caused by an attempt to create a window before Avalonia is properly initialized
Valters
@FaithLV
Dec 25 2018 20:16
yeah, thanks, that does the trick, didn't word it correctly - I'm trying to figure out how I would make the constructor injection automatically, so I only have to define requirements in the constructor arguments (hope it was clear, i don't know the exact terms)
for my own made classes, i automatically injects whatever i need, i'm not sure if it's possible to do it if i have to initialize new
Valters
@FaithLV
Dec 25 2018 20:53
nvm, figured it out, thanks!
Kermalis
@Kermalis
Dec 25 2018 23:54
I have a gif overlaying something with a tooltip, but the gif is mostly transparent and is used as an effect, so I'd like the tooltip to still be able to show, but since the gif is above the control, the tooltip doesn't show anymore, can I stop that behavior?