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

Modify appearance of RadComboBoxes in RadDataForm

1 Answer 15 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 24 Jan 2014, 12:41 PM
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...

 

1 Answer, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 29 Jan 2014, 12:23 PM
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 >>
Tags
DataForm
Asked by
Peter
Top achievements
Rank 1
Answers by
Yoan
Telerik team
Share this question
or