Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > ComboBox > Alert needed on losing focus from Editable Rdcombox if text entered does not match

Not answered Alert needed on losing focus from Editable Rdcombox if text entered does not match

Feed from this thread
  • Manishkumar Master avatar

    Posted on Nov 15, 2011 (permalink)

    Hi,


    I have radcombobox which is

    IsEditable="True" 
    IsTextSearchEnabled="True" 
    TextSearchMode="StartsWith"

     
    Now when user enters some text which is not present in the list that is binded to the radcombobox and the radcombobox loses focus, i want a alert which tells users that value entered is not available and clears the text entered in the radcombobox.

    Please guide.

     

    Reply

  • Yana Yana admin's avatar

    Posted on Nov 16, 2011 (permalink)

    Hi Manishkumar,

    Please find attached a simple example which demonstrates how you can implement validation in RadComboBox.

    Hope it helps.

    All the best,
    Yana
    the Telerik team

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

    Attached files

    Reply

  • Manishkumar Master avatar

    Posted on Nov 18, 2011 (permalink)

    Hi Yana,

    Thanks for replying.
    The example provided is not helping though. I can enter wrong values in the radcombobox and even on losing focus, no alert is thrown to the user.

    Reply

  • Yana Yana admin's avatar

    Posted on Nov 21, 2011 (permalink)

    Hello Manishkumar,

    I've modified the XAML from the project to show how to set ErrorTemplate:

    <Window.Resources
        <ControlTemplate x:Key="ErrorTemplate">
            <DockPanel LastChildFill="True">               
                <TextBlock DockPanel.Dock="Top"
                            Text="{Binding ElementName=comboBox,Path=AdornedElement.(Validation.Errors)[0].ErrorContent}"
                            Foreground="Red"                           
                            FontWeight="Bold"/>
                <Border BorderBrush="Red" BorderThickness="1">
                    <AdornedElementPlaceholder Name="comboBox" />
                </Border>
            </DockPanel>
        </ControlTemplate>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="100" />
            <RowDefinition Height="50" />
        </Grid.RowDefinitions>
            <telerik:RadComboBox x:Name="comboBox" IsEditable="True" Width="300" Height="22"
                            IsTextSearchEnabled="True"
                            TextSearchMode="StartsWith"
                            ItemsSource="{Binding Items}"
                            SelectedValue="{Binding SelectedItem, Mode=TwoWay,NotifyOnValidationError=True, ValidatesOnDataErrors=True}"
                            Validation.ErrorTemplate="{StaticResource ErrorTemplate}"       />
            <Button Content="click" Grid.Row="1" Width="50" Height="22" />
    </Grid>

    Hope this helps.

    All the best,
    Yana
    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 / WPF > ComboBox > Alert needed on losing focus from Editable Rdcombox if text entered does not match
Related resources for "Alert needed on losing focus from Editable Rdcombox if text entered does not match"

WPF ComboBox Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]