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

Binding command to SelectionChanged Event

4 Answers 544 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Devika
Top achievements
Rank 1
Devika asked on 25 Jun 2009, 08:21 AM

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

 

 

 

 

4 Answers, 1 is accepted

Sort by
0
Accepted
Valeri Hristov
Telerik team
answered on 25 Jun 2009, 01:08 PM
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.
0
Devika
Top achievements
Rank 1
answered on 26 Jun 2009, 06:15 AM
Thanks a lot Valeri.. i got the problem with my code. The problem was because i used ComboBoxItem instead of RadComboBoxItem.

Regards
DV
0
Deepthi
Top achievements
Rank 1
answered on 30 Aug 2010, 05:21 AM
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.
0
Kiril Stanoev
Telerik team
answered on 01 Sep 2010, 03:46 PM
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
Tags
ComboBox
Asked by
Devika
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
Devika
Top achievements
Rank 1
Deepthi
Top achievements
Rank 1
Kiril Stanoev
Telerik team
Share this question
or