Modify appearance of RadComboBoxes in RadDataForm

2 posts, 0 answers
  1. Peter
    Peter avatar
    37 posts
    Member since:
    Dec 2011

    Posted 24 Jan 2014 Link to this post

    I have a DataForm with various DataFormComboboxFields. I'm using autogeneration to populate the DataForm.

    How can I change the appearance of RadComboBoxes in the DataFormComboBoxFields at runtime?

    I want to be able to show or hide the SelectionButton that appears inside the ComboBoxes (Property ClearSelectionButtonVisibility  of RadComboBox). Some DataFormComboBoxFields should show this button, others not...

     
  2. Yoan
    Admin
    Yoan avatar
    1068 posts

    Posted 29 Jan 2014 Link to this post

    Hello Peter,

    You can try the following approach:
    private void DataForm1_AutoGeneratingField(object sender, Telerik.Windows.Controls.Data.DataForm.AutoGeneratingFieldEventArgs e)
          {
              if (e.PropertyName == "Gender" )
              {
                  e.DataField.Loaded += new RoutedEventHandler(DataField_Loaded);
              }
          }
          void DataField_Loaded(object sender, RoutedEventArgs e)
          {
              (sender as DataFormComboBoxField).Loaded -= new RoutedEventHandler(DataField_Loaded);
              ((sender as DataFormComboBoxField).Content as RadComboBox).ClearSelectionButtonVisibility = Visibility.Visible;
              ((sender as DataFormComboBoxField).Content as RadComboBox).ClearSelectionButtonContent = "Clear Button";
          }

    Please check the attached sample project for a reference.



    Regards,
    Yoan
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top