Multiple clicks to get focus of a ComboBox in TreeListView

7 posts, 3 answers
  1. Andreas
    Andreas avatar
    23 posts
    Member since:
    Feb 2011

    Posted 09 Mar 2011 Link to this post

    Hello,

    I'm using a RadTreeListView with a GridViewComboBoxColumn. I need at least three clicks to open the dropdown list.
    I assume first is to focus the cell second to get the edit mode third to open the list. Is there a way to do it with only one click?
    Here is the XAML code of my RadTreeListView:

                <t:RadTreeListView x:Name="TreeListView"
                                     AutoGenerateColumns="False"
                                     ItemsSource="{Binding Zeile.Liste}"
                                     SelectedItem="{Binding Current, Mode=TwoWay}"
                                     CanUserReorderColumns="True"
                                     CanUserFreezeColumns="True"
                                     EnableColumnVirtualization="True"
                                     EnableRowVirtualization="True" >

                    <t:RadTreeListView.ChildTableDefinitions>
                        <t:TreeListViewTableDefinition ItemsSource="{Binding Liste}"/>
                    </t:RadTreeListView.ChildTableDefinitions>
                    
                    <t:RadTreeListView.HierarchyChildTemplate>
                        <DataTemplate>
                            <t:RadTreeListView ItemsSource="{Binding Liste}"/>
                        </DataTemplate>
                    </t:RadTreeListView.HierarchyChildTemplate>

                    <t:RadTreeListView.Columns>
                        <t:GridViewComboBoxColumn Header="Bezeichnung"
                                                        DataMemberBinding="{Binding AuswahlListeId}"
                                                        ItemsSourceBinding="{Binding AuswahlListe}"
                                                        SelectedValueMemberPath="Id"
                                                        DisplayMemberPath="Bezeichnung">
                        
                            <t:GridViewComboBoxColumn.CellEditTemplate>
                                <DataTemplate>
                                    <t1:RadComboBox ItemsSource="{Binding VerfuegbarListe}"
                                                          SelectedValue="{Binding AuswahlListeId, Mode=TwoWay}"
                                                          SelectedValuePath="Id"
                                                          DisplayMemberPath="Bezeichnung" />
                                </DataTemplate>
                            </t:GridViewComboBoxColumn.CellEditTemplate>
                        
                        </t:GridViewComboBoxColumn>

                        <t:GridViewDataColumn DataMemberBinding="{Binding Menge}"
                                                    IsReadOnly="True"
                                                    Header="Menge" />
                    </t:RadTreeListView.Columns>
                </t:RadTreeListView>

    Regards,

    Andreas
  2. Answer
    Maya
    Admin
    Maya avatar
    4062 posts

    Posted 09 Mar 2011 Link to this post

    Hi Andreas,

    You may take a look at this forum thread for a reference.
     

    All the best,
    Maya
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. DevCraft banner
  4. Andreas
    Andreas avatar
    23 posts
    Member since:
    Feb 2011

    Posted 10 Mar 2011 Link to this post

    Hi,

    thank you for your help, this is working now. But what do I have to do to switch into the view mode after I have selected one Item from the ComboBox. Right now I have to leave the cell in order to end the edit mode.

    Regards,

    Andreas
  5. Answer
    Maya
    Admin
    Maya avatar
    4062 posts

    Posted 10 Mar 2011 Link to this post

    Hello Andreas,

    In this case you will have to handle the SelectionChanged event of the RadComboBox and commit the changes once a value is selected from it:

    this.RadGridView1.AddHandler(RadComboBox.SelectionChangedEvent, new Telerik.Windows.Controls.SelectionChangedEventHandler(comboSelectionChanged), true);
     
     
    private void comboSelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)
    {
        if (e.RemovedItems.Count != 0)
        {
            //this ensures a selection from the drop down is performed.
            this.RadGridView1.CommitEdit();
        }
    }  

     

    Best wishes,
    Maya
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  6. Andreas
    Andreas avatar
    23 posts
    Member since:
    Feb 2011

    Posted 10 Mar 2011 Link to this post

    Hi Maya,

    intelli sense ist complaining about the first line

    TreeListView.AddHandler(RadComboBox.SelectionChangedEvent, new SelectionChangedEventHandler(comboSelectionChanged), true);

    saying that Argument type 'Telerik.Windows.RoutedEvent is not assignable to parameter type System.Windows.RoutedEvent'.

    Andreas

  7. Answer
    Maya
    Admin
    Maya avatar
    4062 posts

    Posted 10 Mar 2011 Link to this post

    Hi Andreas,

    May you try to add reference to the Telerik.Windows assembly (using Telerik.Windows;) ?
     

    All the best,
    Maya
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  8. Andreas
    Andreas avatar
    23 posts
    Member since:
    Feb 2011

    Posted 10 Mar 2011 Link to this post

    It's working :)

    Thanks a lot,

    Andreas
Back to Top
DevCraft banner