When using a Dataform to edit a collection, having both a RadComboBox
and RadMaskedTextBox on that form will cause a fatal application error.
This occurs even using a simple non-hierarchical base type with only
strings. Having either control by themselves, works fine.
My other problem with RadComboBox is that it does not respect the read-only state of the dataform, like RadMaskedTextBox does.
Can anybody help me to use the standard DataForm with these controls?
Page XAML:
Page Contructor:
Class People:
Class Person:
My other problem with RadComboBox is that it does not respect the read-only state of the dataform, like RadMaskedTextBox does.
Can anybody help me to use the standard DataForm with these controls?
Page XAML:
<dataFormToolkit:DataForm.EditTemplate> |
<DataTemplate> |
<StackPanel> |
<dataFormToolkit:DataField> |
<telerikInput:RadMaskedTextBox MaskType="None" Value="{Binding Name, Mode=TwoWay}"/> |
</dataFormToolkit:DataField> |
<dataFormToolkit:DataField> |
<telerikComboBox:RadComboBox SelectedValue="{Binding Gender, Mode=TwoWay}" SelectedValuePath="Content"> |
<telerikComboBox:RadComboBoxItem Content="Male" /> |
<telerikComboBox:RadComboBoxItem Content="Female" /> |
</telerikComboBox:RadComboBox> |
</dataFormToolkit:DataField> |
</StackPanel> |
</DataTemplate> |
</dataFormToolkit:DataForm.EditTemplate> |
</dataFormToolkit:DataForm> |
Page Contructor:
DataSet = new People(); |
this.ElemForm.ItemsSource = DataSet; |
Class People:
public class People : ObservableCollection<Person> |
{ |
public People() |
{ |
Person John = new Person("John", "Male"); |
Add(John); |
Add(new Person("Sue", "Female")); |
} |
} |
Class Person:
public class Person |
{ |
public string Name { get; set; } |
public string Gender { get; set; } |
public Person() |
{ |
this.Name = ""; |
this.Gender = ""; |
} |
public Person(string name, string gender) |
{ |
this.Name = name; |
this.Gender = gender; |
} |
} |