Issue with RadDropDownButton collapse

5 posts, 0 answers
  1. Shweta
    Shweta avatar
    11 posts
    Member since:
    Oct 2011

    Posted 02 Dec 2011 Link to this post

    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>    

  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    3154 posts

    Posted 06 Dec 2011 Link to this post

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

  3. Shweta
    Shweta avatar
    11 posts
    Member since:
    Oct 2011

    Posted 07 Dec 2011 Link to this post

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

    }

  4. Shweta
    Shweta avatar
    11 posts
    Member since:
    Oct 2011

    Posted 07 Dec 2011 Link to this post

    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

    }



  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    3154 posts

    Posted 07 Dec 2011 Link to this post

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

Back to Top