Page 1 of 1

Copy/Paste Commands in XAML

Posted: 06 Apr 2023, 11:23
by samrrr
            <TextBox.ContextMenu>
                <ContextMenu>
                    <MenuItem
                        Header="{Binding Source=#Translatable:MenuCut, Converter={StaticResource LocalizationConverter}}"
                        Command="Cut">
                    </MenuItem>
                    <MenuItem
                        Header="{Binding Source=#Translatable:MenuCopy, Converter={StaticResource LocalizationConverter}}"
                        Command="Copy">
                    </MenuItem>
                    <MenuItem
                        Header="{Binding Source=#Translatable:MenuPaste, Converter={StaticResource LocalizationConverter}}"
                        Command="Paste">
                    </MenuItem>
                </ContextMenu>
            </TextBox.ContextMenu>
            
In WPF work but in Noesis 3.1.5 this:
NOESIS E ../data/nassets/UI/Screens/ProfileNameDialog.xaml(230): Unable to convert 'Cut' to a valid value for property MenuItem.Command.
NOESIS E ../data/nassets/UI/Screens/ProfileNameDialog.xaml(234): Unable to convert 'Copy' to a valid value for property MenuItem.Command.
NOESIS E ../data/nassets/UI/Screens/ProfileNameDialog.xaml(238): Unable to convert 'Paste' to a valid value for property MenuItem.Command.
How fix this error?

Re: Copy/Paste Commands in XAML

Posted: 11 Apr 2023, 14:35
by sfernandez
The Cut/Copy/Paste commands are part of the ApplicationCommands class. It seems that WPF supports omiting the class for those commands, we should support that, could you please report it in our bugtracker?

In the meantime you can provide the class name to make it work in Noesis too:
    <ContextMenu>
      <MenuItem Command="ApplicationCommands.Cut"/>
      <MenuItem Command="ApplicationCommands.Copy"/>
      <MenuItem Command="ApplicationCommands.Paste"/>
    </ContextMenu>

Re: Copy/Paste Commands in XAML

Posted: 17 Apr 2023, 10:36
by samrrr
With ApplicationCommands. this work in noesis thanks.

I dont know this bug on not. If you know this a bug 100% then you can post in bugtracker.

Re: Copy/Paste Commands in XAML

Posted: 19 Apr 2023, 16:37
by sfernandez
We implemented support for specifying only the name for ApplicationCommands and ComponentCommands: #2574