Add new button in GridViewComboBoxColumn

5 posts, 0 answers
  1. Paul
    Paul avatar
    26 posts
    Member since:
    Jan 2012

    Posted 22 May 2012 Link to this post

    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  
  2. Boyan
    Admin
    Boyan avatar
    758 posts

    Posted 28 May 2012 Link to this post

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

  3. DevCraft banner
  4. Paul
    Paul avatar
    26 posts
    Member since:
    Jan 2012

    Posted 08 Jun 2012 Link to this post

    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
  5. Boyan
    Admin
    Boyan avatar
    758 posts

    Posted 13 Jun 2012 Link to this post

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

  6. Paul
    Paul avatar
    26 posts
    Member since:
    Jan 2012

    Posted 13 Jun 2012 Link to this post

    Ok Thanks Boyan
Back to Top
DevCraft banner