Open RadDropDownButton from control event inside Content

2 posts, 1 answers
  1. Semyon Akimov
    Semyon Akimov avatar
    13 posts
    Member since:
    Dec 2008

    Posted 11 Feb 2012 Link to this post

    Hello.

    I have dropdownbutton with textbox inside content.
    Inside of TextBox MouseLeftButtonDown event handler I am trying to open dropdown.
    So on first click on textbox dropdown opens and immediately closes.
    On second click all works as expected - drop down opens normally.

    <telerik:RadDropDownButton x:Name="PointDropDown"
                                          Grid.Column="1"
                                          Height="22"
                                          Width="600"
                                          Margin="3"
                                          HorizontalContentAlignment="Stretch"
                                          VerticalContentAlignment="Stretch">
        <telerik:RadDropDownButton.Content>
            <TextBox x:Name="SelectedPointTextBox"
                             BorderBrush="Transparent"
                             Background="Transparent"
                             HorizontalAlignment="Stretch"
                             Cursor="Arrow"
                             VerticalAlignment="Stretch"
                             IsReadOnly="True"
                             Padding="0, -3, 0, -3"
                             Text="TextBlockText"
                             IsTabStop="False"
                             TextAlignment="Left"
                             MouseLeftButtonDown="SelectedPointTextBoxMouseLeftButtonDown"/>
        </telerik:RadDropDownButton.Content>
        <telerik:RadDropDownButton.DropDownContent>
            <telerik:RadGridView x:Name="PointGridView"
                                         MaxWidth="450"
                                         MaxHeight="350"
                                         IsReadOnly="False"
                                         RowIndicatorVisibility="Collapsed"
                                        >
            </telerik:RadGridView>
        </telerik:RadDropDownButton.DropDownContent>
    </telerik:RadDropDownButton>

    private void SelectedPointTextBoxMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
            {
                PointDropDown.Focus();
                PointDropDown.IsOpen = true;
            }

    You can download sample project here
    How to fix this behavior?

    Thanks.
  2. Answer
    Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 15 Feb 2012 Link to this post

    Hi,

     The default behavior of the RadDropDownButton is to open on mouseUp so I don't think that you need this event handler - the DropDownButton will automatically open.
    I've attached a project without the handler so could you please examine it and see it this is what you're looking for?

    Regards,
    Zarko
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft banner
Back to Top