These are chat archives for AvaloniaUI/Avalonia

9th
Dec 2015
danwalmsley
@danwalmsley
Dec 09 2015 09:55

@grokys / @kekekeks in perspex in ViewModel whats the best way to pickup key presses, for example I want when someone presses CTRL + S to execute a save command,

or should my control pickup this keypress, and I put a SaveCommand property on my control?

Nikita Tsukanov
@kekekeks
Dec 09 2015 11:19
There should be hotkey support
See HotKeyManager.HotKey attached property
It can be applied to buttons and menu items
There is also InputElement.KeyBindings property
Wiesław Šoltés
@wieslawsoltes
Dec 09 2015 13:00
The KeyBindings property does not work from Xaml
and HotKey has some issues Perspex/Perspex#290 and Perspex/Perspex#296
danwalmsley
@danwalmsley
Dec 09 2015 13:54
thanks guys seems to work for me...
do we have some kind of context menu control yet?
Reed Copsey, Jr.
@ReedCopsey
Dec 09 2015 17:04
Question : is there any support for routing events to ICommand in the data context? Either behavior style, markup on events, etc?
Steven Kirk
@grokys
Dec 09 2015 18:47
@ReedCopsey no inbuilt support currently, but you should be able to write a behavior using attached properties to do it
@donandren thanks for the repro - i'm currently rewriting a fair bit of TabControl as there are a few problems with it, I will try your tests again afterwards
Andrey Kunchev
@donandren
Dec 09 2015 18:55
@grokys actually the problem is not in the tab control itself, but more in the architecture. Because the problem is reproduced when control is removed from visual tree, but not from logical tree. Then when added again to visual tree the style is applied, and the old values for StyleActivator are still monitoring the control properties
Steven Kirk
@grokys
Dec 09 2015 18:56
yeah, i know - styles need to be based on the logical tree: Perspex/Perspex#341
that's actually part of what i'm doing, except that TabControl doesn't correctly handle the logical tree, so it needs to be changed
Wiesław Šoltés
@wieslawsoltes
Dec 09 2015 18:57

Question : is there any support for routing events to ICommand in the data context? Either behavior style, markup on events, etc?

@ReedCopsey I am working on port of XamlBehaviors here Perspex/Perspex#342, there is currently issue with attached properties in OmniXaml SuperJMN/OmniXAML#65 so only code behind works with Perspex, there is EventTriggerBehavior and InvokeCommandAction