New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Menu problem in AvalonStudio and Core2D #564
Comments
Ok, this wasn't an OmniXaml problem, sorry @SuperJMN ;) It should now be fixed in master. The full XAML for Core2D's Template menu should be:
|
;) |
Thanks @grokys this works very nice. Also added missing command bindings: <Setter Property="Command" Value="{Static Editor:Commands.ApplyTemplateCommand}"/>
<Setter Property="CommandParameter" Value="{Binding}"/> |
@grokys I have issue with command using your solution, in some cases commands are executed twice, first with valid This are my changes in Core2D: wieslawsoltes/Core2D@5a71dd5 This two cause |
cc: @danwalmsley @wieslawsoltes
There is a menu problem in AvalonStudio and Core2D where menu items are created dynamically from
Items
. The XAML in the case of Core2D currently looks like this:This is causing a problem because the data template is creating a
MenuItem
which gets placed inside theMenuItem
created by Avalonia! If you think about it, this makes sense - when you write aDataTemplate
for a list box you don't have a<ListBoxItem>
at the root - theDataTemplate
describes the contents. This is the same in WPF - you have to useItemContainerStyle
to set theMenuItem.Header
(http://weblogs.asp.net/okloeten/5149692 describes our exact same problem in WPF).We don't have
ItemContainerStyle
, but our styling system is more powerful than WPF's so we shouldn't need it. However, the following wasn't working:But I've fixed that, so the basic case should work.
The next problem is that Core2D wants to set the
MenuItem.Icon
property too. Putting the<CheckBox>
as the style value failed however, as the sameCheckBox
was getting assigned to eachMenuItem
.The solution for this was to add a
<Template>
which can be placed inside a style value. So the equivalent of the original Core2DDataTemplate
above is:cc: @SuperJMN
This is also implemented, but it seems we're hitting an OmniXaml bug. I will try to reproduce in a short sample and add an OmniXaml issue. I will close this issue when everything is working.
The text was updated successfully, but these errors were encountered: