Binding command to SelectionChanged Event

5 posts, 1 answers
  1. Devika
    Devika avatar
    8 posts
    Member since:
    May 2009

    Posted 25 Jun 2009 Link to this post

    I have declared a combobox as below by attaching a command: But it is not working. But when I attach DropDownOpened event it works for me. Please help.

     

    <telerikInput:RadComboBox Width="50" Height="20" app:RateTableViewModel.Command="{Binding Path=TelrikComboChange}" > 
     
    <ComboBoxItem Content="Balance"/>  
     
    <ComboBoxItem Content="Fee"/>  
     
    <ComboBoxItem Content="Age"/>   
     
    </telerikInput:RadComboBox> 
     


    And in the viewModel i have the commandPropertyChange as below:

     
     
    private static void OnCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)  
     
    {  
     
    if (d is RadComboBox)  
     
    {  
     
    RadComboBox b = d as RadComboBox;  
     
    ICommand c = e.NewValue as ICommand;  
     
    b.SelectionChanged += delegate(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs arg) { c.Execute(null); };  
     
    }   
     
    }   
     
       
     
    public ICommand TelrikComboChange  
     
    {  
     
                get  
     
                {  
     
       
     
                    return new RelayCommand(param => TelrikComboChange_Executed());  
     
                }  
     
            }  
     
            void TelrikComboChange_Executed()  
     
            {  
     
                MessageBox.Show("Hello");  
     
            }  
     
       
     

     

     

     

     

  2. Answer
    Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 25 Jun 2009 Link to this post

    Hi Devika,

    I created a simple application that appears to be working on my side. I used the latest internal build assemblies. Am I missing something?

    Sincerely yours,
    Valeri Hristov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. DevCraft banner
  4. Devika
    Devika avatar
    8 posts
    Member since:
    May 2009

    Posted 26 Jun 2009 Link to this post

    Thanks a lot Valeri.. i got the problem with my code. The problem was because i used ComboBoxItem instead of RadComboBoxItem.

    Regards
    DV
  5. Deepthi
    Deepthi avatar
    7 posts
    Member since:
    Jul 2010

    Posted 30 Aug 2010 Link to this post

    Hi,

    I am using the RadTreeView control. i am not able to use the command binding on the control. Let me know how can i implement the command binding on this control.

    Thank you,
    Deepthi.
  6. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1511 posts

    Posted 01 Sep 2010 Link to this post

    Hello Deepthi,

    RadTreeView does not support command binding since it is not a command source. I've added an item in our public issue tracking system called "TreeView: CommandBindings support" which will be available for tracking and voting tomorrow the latest. If this item gathers enough popularity we will definitely implement it.

    Greetings,
    Kiril Stanoev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top
DevCraft banner