Hello,
We have a XamTextEditor which resides in a grid. On that window we have a command bound 'enter' shortcut key. But for some reason first 'enter' key is being absorbed by XamEditor. When you hit enter again it calls the command. We switch to WPF's TextBox as a workaround right now. (2012.2 June Service Version).
Window x:Class="TestClass" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" WindowStartupLocation="CenterScreen" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:editors="clr-namespace:NorthPoint.FormPf.Common.UI.Wpf.Controls.Editors" SizeToContent="WidthAndHeight" Title="{Binding Title}" ResizeMode="NoResize"> <Window.InputBindings> <KeyBinding Key="Escape" Command="{Binding CloseCommand}" /> <KeyBinding Key="Enter" Command="{Binding SearchCommand}" /> </Window.InputBindings> <Grid> <Grid.ColumnDefinitions > <ColumnDefinition Width="330"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="30"/> <RowDefinition Height="10"/> <RowDefinition Height="*"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <Border Background="{StaticResource ToolBarFill}"/> <TextBlock Grid.Row="0" Text="Search Data" VerticalAlignment="Center" Margin="5,0,0,3" FontSize="{StaticResource WindowTitleFontSize}" FontWeight="Bold" Foreground="{StaticResource WindowTitleForeground}" />
<ItemsControl Grid.Row="2" ItemsSource="{Binding DataPredicates}"> <ItemsControl.ItemTemplate> <DataTemplate> <Grid> <Grid.ColumnDefinitions > <ColumnDefinition Width="150"/> <ColumnDefinition Width="175"/> </Grid.ColumnDefinitions> <Label Content="{Binding Label, StringFormat= '\{0\}'}"/>
<ig:XamTextEditor Height="auto" Width="auto" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type EditorBase}}, Path=Value, ValidatesOnDataErrors=True}" InvalidValueBehavior="RevertValue" IsTabStop="True" Background="White" IsReadOnly="{Binding Path=IsBool, Converter={StaticResource boolConverter}, RelativeSource={RelativeSource AncestorType={x:Type Controls:IHaveSmth}}}"> </ig:XamTextEditor>
</Grid> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </Grid></Window>
Hi Murat,
The enter key is handled by the XamTextEditor so it's not going to bubble up to the window and trigger the key binding. To workaround this you'll need to handle the PreviewKeyDown event on the Window and execute the appropriate key bindings manually. I've attached an example that uses an attached behavior which makes this mvvm friendly.
Let me know if you have any further questions on this.
Hi,
I have a XamTextEditor.Whenever I type into XamTextEditor its not allowing me to type into entire width.
For example,
<igEditors:XamTextEditor Text={Binding Name} Width=300>
XamTextEditor will not allow me to enter 300 characters to the full width.Whenever I type after some limit the text will go to nextline or beyond the screen.
Could you please suggest me how to solve it.
Hello Prasanti,
I wasn't able to reproduce the issue you described. See my attached sample using a XamTextEditor. Can you modify it to reproduce your issue and then send it back to me?