Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > Buttons > RadDropDownButton - Textboxes ignore the first <space> character...

Not answered RadDropDownButton - Textboxes ignore the first <space> character...

Feed from this thread
  • Rob Master avatar

    Posted on Aug 31, 2011 (permalink)

    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>

    Reply

  • Tina Stancheva Tina Stancheva admin's avatar

    Posted on Sep 5, 2011 (permalink)

    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 >>

    Reply

  • Juliana avatar

    Posted on Sep 23, 2011 (permalink)

    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

    Reply

  • Tina Stancheva Tina Stancheva admin's avatar

    Posted on Sep 26, 2011 (permalink)

    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 >>

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > Buttons > RadDropDownButton - Textboxes ignore the first <space> character...