it will show ApplicationCommands.paste value but it is not preserved.
onkeypress or tab change, it will change to old value and new paste value will never updated.
I also used CommandBindings in constructor of RadMaskedNumericInput. but it doesn't work.
CommandBindings.Add(
new CommandBinding(ApplicationCommands.Paste, (sender, e) =>
{
double inputValue;
bool isInputNumber = double.TryParse(Clipboard.GetText(), out inputValue);
this.Value = inputValue;
e.Handled = true;
}));
9 Answers, 1 is accepted
Thank you for bringing this issue to our attention. I have logged it as a bug in our PITS and you can follow and vote for it here. I also updated your Telerik account.
Kind regards,
Pavel R. Pavlov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Thanks for response. is any workaround solution? since we have planned release next week, and would like to use applicationcommand feature for paste.
We managed to create a workaround for the following configuration:
<
telerik:RadToolBar
>
<
telerik:RadButton
Command
=
"ApplicationCommands.Copy"
Content
=
"Copy"
x:Name
=
"copyButton"
/>
<
telerik:RadButton
Command
=
"ApplicationCommands.Paste"
CommandTarget
=
"{Binding ElementName=xNumericInput}"
Content
=
"Paste"
x:Name
=
"pasteButton"
/>
</
telerik:RadToolBar
>
<
TextBox
/>
<
telerik:RadMaskedNumericInput
x:Name
=
"xNumericInput"
IsClearButtonVisible
=
"False"
IsLastPositionEditable
=
"False"
/>
You have to create a CommandBinding like so:
<
Window.CommandBindings
>
<
CommandBinding
Command
=
"ApplicationCommands.Paste"
Executed
=
"CommandBinding_Executed_1"
/>
</
Window.CommandBindings
>
private void CommandBinding_Executed_1(object sender, ExecutedRoutedEventArgs e)
{
this.xNumericInput.PasteCommand.Execute(null);
e.Handled = true;
}
Kind regards,
Petar Mladenov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Thanks for response and demo project.
but it is restricting to only numeric control to paste value with CommandTarget property.
It should be flexible to paste value in multiple controls as well as any type of controls (Textbox, listbox, combobox, Radmaskednumeric).
Also i have created custom control (wrapper on Radmaskednumericinput control to specify default properties).
Please refer below code and inform how Applicationcommand.paste can be worked with all below controls.
MainWindow.xaml
----------------------------
<Window x:Class="WpfApplication5.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
Title="MainWindow"
Width="525"
xmlns:local="clr-namespace:WpfApplication5"
Height="350">
<Window.CommandBindings>
<CommandBinding Command="ApplicationCommands.Paste"
Executed="CommandBinding_Executed_1" />
</Window.CommandBindings>
<StackPanel >
<telerik:RadToolBar >
<telerik:RadButton Command="ApplicationCommands.Copy" Content="Copy" x:Name="copyButton"/>
<telerik:RadButton Command="ApplicationCommands.Paste" Content="Paste" x:Name="pasteButton"/>
</telerik:RadToolBar>
<TextBox Text="123" />
<TextBox Text="456"/>
<TextBox Text="789" />
<TextBlock Height="20" Text="123456789"></TextBlock>
<Label Content="1234"/>
<local:FormattedNumericInput Width="50" />
<local:FormattedNumericInput Width="50" />
</Window>
FormatNumericControl.cs
-----------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
namespace WpfApplication5
{
public class FormattedNumericInput : Telerik.Windows.Controls.RadMaskedNumericInput
{
#region Constructors
public FormattedNumericInput()
{
AllowNegativeNumbers = false;
IsClearButtonVisible = false;
SelectionOnFocus = Telerik.Windows.Controls.SelectionOnFocus.DefaultSelectAll;
Mask = "";
FormatString = "0";
SpinMode = Telerik.Windows.Controls.MaskedInput.SpinMode.None;
}
#endregion
}
}
base.CommandBindings.Add( new CommandBinding(ApplicationCommands.Paste,Paste_CanExecuteChanged))
Currently we are not aware of a suitable workaround to match your requirements. We will try to fix the issue in our next Q1 Release. Thank you for your understanding.
Kind regards,Petar Mladenov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Please advise when is Q1 release date / fix will be ready to use?
Q1 2013 is scheduled for the middle of February.
Regards,Petar Mladenov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.