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

Add new button in GridViewComboBoxColumn

4 Answers 87 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 22 May 2012, 02:53 PM
Hi

I can change the 'EditorStyle' to set the properties for the 'ClearSelectionVisibility' and the 'ClearSelectionButtonContent' which will add a button to the top of the list(combined with the itemsource).

Is there a way to override whatever method the 'ClearSelectionButton' calls so that I can use it to call a method in my viewmodel.  I would like to allow the user to be able to open a screen to enter a new record if the item is not already in the list.  I cannot let them directly enter a new item to the combobox as the item in the combobox requires a lot of properties.

Does this make sence?

Thanks
Paul  

4 Answers, 1 is accepted

Sort by
0
Boyan
Telerik team
answered on 28 May 2012, 09:01 AM
Hi Paul,

In order to implement your custom logic to the clear button you need to edit the template and add a command:
Copy Code
<telerik:RadButton x:Name="PART_ClearButton" Command="local:MyCommand.SelectUnselectCommand"  Content="{TemplateBinding ClearSelectionButtonContent}" Margin="-1 -1 -1 0" Grid.Row="0" telerik:StyleManager.Theme="{StaticResource Theme}" Visibility="{TemplateBinding ClearSelectionButtonVisibility}" />
 
Note that you have to change the x:Name as if left like this it will still execute the clear action as well as your command.

Don't hesitate to contact us if you have other questions.



All the best,
Boyan
the Telerik team

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

0
Paul
Top achievements
Rank 1
answered on 08 Jun 2012, 01:25 PM
Hi Boyan

Thanks for reply sorry getting back so late.

Am I right in saying that I would have to have a seperate style for each combobox as the method and paramerters to be called/passed are hardcoded into the style itself?

Thanks
Paul
0
Boyan
Telerik team
answered on 13 Jun 2012, 08:18 AM
Hi Paul,

It will be best to use different styles if the ComboBoxes you need are not that much. Another way to do this is to use one style but to pass some Command parameter that will allow you to differentiate the ComboBoxes and execute different code. Note that this is not so elegant solution.


Regards,
Boyan
the Telerik team

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

0
Paul
Top achievements
Rank 1
answered on 13 Jun 2012, 08:46 AM
Ok Thanks Boyan
Tags
ComboBox
Asked by
Paul
Top achievements
Rank 1
Answers by
Boyan
Telerik team
Paul
Top achievements
Rank 1
Share this question
or