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

Issue with RadDropDownButton collapse

4 Answers 89 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Shweta
Top achievements
Rank 1
Shweta asked on 02 Dec 2011, 09:27 AM
Hi Team,
I am using RadDropDownButton in my project, which conatins 4 items. On selection of any item, one new window pops up.
My problem is, after the selection of item from dropdownbutton, it reamins open.
And our requirement is to close that dropdownlist as soon as selection is made.

Kindly let me know, howe can I achieve this.
I am puting my code here, which will give you better idea.

<telerik:RadDropDownButton>
 <telerik:RadDropDownButton.Content>
   <StackPanel Orientation="Horizontal">
            <Image Source="/Cirrus.Core.UI.Images;component/Images/new.png" Style="{StaticResource ToolBarButtonImage}" />
            <TextBlock Text="{Binding Source={StaticResource c}, Path=s.AddANewDevice}" Style="{StaticResource                         ToolBarButtonText}"  />
  </StackPanel>
 </telerik:RadDropDownButton.Content>
 <telerik:RadDropDownButton.DropDownContent>
           <ListBox ItemsSource="{Binding DeviceTypes}" DisplayMemberPath="Display" SelectedItem="{Binding   SelectedDeviceType, Mode=TwoWay}" Width="132" />                               
 </telerik:RadDropDownButton.DropDownContent>
</telerik:RadDropDownButton>    

4 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 06 Dec 2011, 03:14 PM
Hi Shweta,

 I prepared a project for you demonstrating a possible approach. Basically, I use the DropDownOpened event of the DropDownButton and the SelectionChanged event of the ListBox. Please let us know if this satisfies you.

Greetings,
Petar Mladenov
the Telerik team

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

0
Shweta
Top achievements
Rank 1
answered on 07 Dec 2011, 06:18 AM
Hi Team,
Thanks for your response.
I tried your code, but I am getting button instance as null.  

 

private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) 

{  

   if (dropDownButtonOpened) 

    {  this.button.IsOpen = false; }

}

0
Shweta
Top achievements
Rank 1
answered on 07 Dec 2011, 06:41 AM
Hi Petar,
I am able to resolve my issue.
I just did an addiiotnla casting and it worked

 

private void button_DropDownOpened(object sender, RoutedEventArgs e) 

{  dropDownButtonOpened = true
   button = sender as RadDropDownButton

}



0
Petar Mladenov
Telerik team
answered on 07 Dec 2011, 10:15 AM
Hello Shweta,

 We are glad to hear that you have resolved this. Please feel free to ask if you need further assistance.

All the best,
Petar Mladenov
the Telerik team

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

Tags
General Discussions
Asked by
Shweta
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Shweta
Top achievements
Rank 1
Share this question
or