Hi,
I have three choices for one of the property and I am showing them in combobox.Once user changes the choices we will take confirmation from user if he says no I have to retain the old value and show in the combo the selected value as oldvalue.But here I am not changing the value of model property but combobox value changing to new value.How to stop it??
For Example:
Property Name :Transportation
Property Values : Enum vehicles
{
Bus,
Car,
Walk
}
7 Answers, 1 is accepted
Hi,
In the above post I have given half information. If Selected value is Bus and then user changes to car.We will ask confirmation and If he says no I should not select car.But here in propertygrid it is showing Car.
How to stop this??
Regards,
Nagasree.
Basically, you should be able to revert to the previous selected item through the Selection mechanism of the control. May I ask you to share a little more information on how the combobox editor is defined?
Best Regards,
Stefan X1
Telerik by Progress
Hi Stefan,
I didn't specified Combobox Editor,PropertyGrid itself giving the Combobox Editor as the property type is Enum. As we know based on the type of the property propertygrid itself provides respective template for the PropertyValue,here I am gettting the Combobox.
Regards,
Nagasree
RadPropertyGrid does not expose its autogenerated editors for such modifications. A possible approach would be to define the EditorTemplate for the particular PropertyDefinition and setup the combobox within it. Please take a look at the Customized Property Definitions topic for more information on the matter.
Hopefully, this helps.
Regards,
Stefan X1
Telerik by Progress
Hi Stefan,
I have checked ComboboxEditorBooleanProperty_WPF sample application. I already tried to create usercontrol and use it.But I am not able to achieve my expected behavior.
http://www.telerik.com/forums/how-to-show-list-string-as-combobox-values-instead-of-collection-editor
I have explained my problem in the above post still clearly. I completely blocked by this problem.Could you please help me??
Hi Stefan,
I am providing some more information here. Last one week I am doing lot of trial and errors.I will share that information with so that you can help me further.
<
UserControl
x:Class
=
"DataGrid.CustomCombo"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable
=
"d"
d:DesignWidth
=
"289"
Height
=
"69"
>
<
StackPanel
>
<
telerik:RadComboBox
Name
=
"ControlCombo"
SelectedIndex
=
"{Binding SelectedValue, Mode=TwoWay}"
/>
</
StackPanel
>
</
UserControl
>
Property for which I am using above mentioned usercontrol as Editor.
private
String _stringProperty =
"Hi"
;
[Telerik.Windows.Controls.Data.PropertyGrid.Editor(
typeof
(CustomCombo),
"SelectedValue"
, Telerik.Windows.Controls.Data.PropertyGrid.EditorStyle.None)]
public
String StringProperty
{
get
{
return
_stringProperty;
}
set
{
_stringProperty = value;
}
}
private
List<String> myVar =
new
List<
string
>() {
"Nagasree"
,
"Sumasree"
,
"Sreeram"
};
public
List<String> MyProperty
{
get
{
return
myVar; }
set
{ myVar = value; }
}
I am populating the combobox from code behind in fieldloaded event as I didn't find any nice other approach as shown below.
private
void
PropertyGrid_FieldLoaded(
object
sender, FieldEventArgs e)
{
if
(e.Field.Content
is
CustomCombo)
{
CustomCombo cb = e.Field.Content
as
CustomCombo;
cb.ControlCombo.ItemsSource = ((Employee)cb.DataContext).MyProperty;
}
}
Now I want to bind the selected Item in the combobox to the string Property.How to achieve this??
I tried to bind to the property in usercontrol creating DependencyProperty but I am not succesful.Please give solution as soon as possible.
Regards,
Nagasree.
Hi,
I found answer here http://www.telerik.com/forums/how-to-show-list-string-as-combobox-values-instead-of-collection-editor#JX8h-tbgvkS_iBnINcu9iQ