This is a migrated thread and some comments may be shown as answers.

[Solved] RadDropDownButton - Textboxes ignore the first <space> character...

3 Answers 118 Views
Buttons
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Rob
Top achievements
Rank 1
Rob asked on 31 Aug 2011, 04:14 PM

There was a very similar issue to this logged here.

And here is a simple project showing the problem.  Notice that when you attempt to enter a <space> in either of the TextBox controls, the first keypress seems to be ignored.  Subsequent <space> characters are ok.

<UserControl    x:Class="SilverlightApplication61.MainPage"
>
 
<UserControl.Resources>
   <DataTemplate x:Key="LabelTemplate">
      <TextBlock Text="{Binding ., StringFormat='\{0\}:'}" VerticalAlignment="Center" Foreground="Green" FontSize="12" Margin="25,0,5,0" />
   </DataTemplate>
</UserControl.Resources>
         
<Grid x:Name="LayoutRoot" Background="White">
 
   <telerik:RadDropDownButton Height="50" Width="50" DropDownWidth="280">
 
      <telerik:RadDropDownButton.DropDownContent>
 
         <Grid>
                     
            <Grid.RowDefinitions>
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
                     
            <Grid.ColumnDefinitions>
               <ColumnDefinition Width="Auto" />
               <ColumnDefinition Width="1*" />
            </Grid.ColumnDefinitions>
 
            <telerik:Label Grid.Row="0" Grid.Column="0" Content="Field 1" ContentTemplate="{StaticResource LabelTemplate}" />
            <TextBox Grid.Row="0" Grid.Column="1" FontSize="14" Text="{Binding Field1, Mode=TwoWay}" Margin="0,4,3,2" />
 
            <telerik:Label Grid.Row="1" Grid.Column="0" Content="Field 2" ContentTemplate="{StaticResource LabelTemplate}" />
            <TextBox Grid.Row="1" Grid.Column="1" FontSize="14" Text="{Binding Field2, Mode=TwoWay}" Margin="0,4,3,2" />
                 
         </Grid>
             
      </telerik:RadDropDownButton.DropDownContent>
 
   </telerik:RadDropDownButton>
    
</Grid>
     
</UserControl>

3 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 05 Sep 2011, 12:48 PM
Hi Rob,

This is a known issue that is logged in our PITS where you can track its progress. We will do our best to fix it as soon as possible and you can vote for it in order to increase its priority.

Regards,
Tina Stancheva
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Juliana
Top achievements
Rank 1
answered on 23 Sep 2011, 12:06 PM
Hi there,
I use the following workaround for this problem

private void TextBox_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.Key)
            {
                case System.Windows.Input.Key.Space:
                    AddCharachterToTextBox((TextBox)e.OriginalSource, " " );
                    e.Handled = true;
                    break;
                case System.Windows.Input.Key.Enter:
                    AddCharachterToTextBox((TextBox)e.OriginalSource, "\n");
                    e.Handled = true;
                    break;
            }
        }
        
        void AddCharachterToTextBox(TextBox textBox, string newChar)
        {
            int position = textBox.SelectionStart;
            textBox.Focus();
            textBox.Text = textBox.Text.Insert(textBox.SelectionStart, newChar);
            textBox.SelectionStart = position + newChar.Length;
        }

HTH,
Juliana
0
Tina Stancheva
Telerik team
answered on 26 Sep 2011, 05:17 PM
Hello Juliana,

Thank you for sharing your solution with the community. I am sure it will be highly appreciated.

Kind regards,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
Buttons
Asked by
Rob
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Juliana
Top achievements
Rank 1
Share this question
or