Help with CustomEditor

4 posts, 0 answers
  1. Rayne
    Rayne avatar
    241 posts
    Member since:
    Sep 2010

    Posted 09 Feb 2012 Link to this post

    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?
  2. Rayne
    Rayne avatar
    241 posts
    Member since:
    Sep 2010

    Posted 09 Feb 2012 Link to this post

    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?
  3. UI for WPF is Visual Studio 2017 Ready
  4. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 10 Feb 2012 Link to this post

    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 >>
  5. Vega
    Vega avatar
    2 posts
    Member since:
    Oct 2009

    Posted 07 Jul 2014 Link to this post

    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 
Back to Top