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

Help with CustomEditor

3 Answers 30 Views
DataFilter
This is a migrated thread and some comments may be shown as answers.
Rayne
Top achievements
Rank 1
Rayne asked on 09 Feb 2012, 08:14 PM
I'm trying to create a custom editor using a comboBox. It correctly displays the combobox when I select the property, but I can't seem to get it display the collection. I'm binding it to a property on my viewmodel and stepping through the code, I know this collection is being loaded with data.

<DataTemplate x:Key="RequestorEditor">
   <telerik:RadComboBox SelectedValue="{Binding Value, Mode=TwoWay, FallbackValue=null}"
      MinWidth="100" ItemsSource="{Binding Requestors}" DisplayMemberPath="FullName"
      SelectedValuePath="UserID" />
</DataTemplate>

Is there a reason it wouldn't work?

3 Answers, 1 is accepted

Sort by
0
Rayne
Top achievements
Rank 1
answered on 09 Feb 2012, 08:27 PM
OK, I checked my databinding warnings and found that it's trying to bind using SimpleFilterViewModel. I changed it to use the RelativeAncestor like so:
ItemsSource="{Binding DataContext.Requestors, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}"

but now I get an error when I click the + to add a new filterDescriptor via the control: "Input string was not in a correct format." I'm guessing because the property I'm trying to work with is the first one that loads.

Any ideas?
0
Rossen Hristov
Telerik team
answered on 10 Feb 2012, 10:14 AM
Hello,

I am really not sure why your code does not work.

Here we have an example with a custom combo box editor. I hope this helps.

All the best,
Ross
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Vega
Top achievements
Rank 1
answered on 07 Jul 2014, 10:39 AM
I know this is an old thread, but I just encountered the same problem as Rayne & after a bit of investigation found that the problem was with FallbackValue=null. This was not setting the value to Null (Nothing), but to a String called 'null'. You can see this by inspecting the e.Editor (combo box) and looking at the selected value, which was of type String. Removing the FallbackValue worked for me 
Tags
DataFilter
Asked by
Rayne
Top achievements
Rank 1
Answers by
Rayne
Top achievements
Rank 1
Rossen Hristov
Telerik team
Vega
Top achievements
Rank 1
Share this question
or