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

Open RadDropDownButton from control event inside Content

1 Answer 100 Views
Buttons
This is a migrated thread and some comments may be shown as answers.
Semyon Akimov
Top achievements
Rank 1
Semyon Akimov asked on 12 Feb 2012, 01:53 AM
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.

1 Answer, 1 is accepted

Sort by
0
Accepted
Zarko
Telerik team
answered on 15 Feb 2012, 05:11 PM
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 >>
Tags
Buttons
Asked by
Semyon Akimov
Top achievements
Rank 1
Answers by
Zarko
Telerik team
Share this question
or