DataFormComboBoxField issues

10 posts, 0 answers
  1. steve
    steve avatar
    9 posts
    Member since:
    Nov 2010

    Posted 29 Nov 2011 Link to this post

    Hello Telerik Forum!

    I am having some strange issues with the DataFormComboBoxField.

    <telerik:DataFormComboBoxField Grid.Row="2" Grid.Column="1" 
                                                           SelectedValuePath="CategorieId" DisplayMemberPath="Categorie"
                                                           ItemsSource="{Binding Categories, Source={StaticResource TEST}}"
                                                           DataMemberBinding="{Binding CategorieId, Mode=TwoWay}" />

    Me.Personen = New ObservableCollection(Of Personen)()
    Me
    .Categories = New ObservableCollection(Of PersoonCategorie)


    My model is in attachement.

    The datacontext of my view is Personen, and a statis resource 'TEST' for Categories

    When i edit my form, the combobox loads correctly, also, when i change the value, it makes the changes in my RadGrid also properly.
    However, once i end edit mode, and try to save, it gives me a NULL field.

    So for some reason, the categorieId field DOES change (visible in my grid), but it makes itself go NULL value.

    Any help on this please? I am in a hury to finish this project.

    Thank you very much!
  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 02 Dec 2011 Link to this post

    Hi Steve,

    Please, excuse me for the late reply. I have tried to reproduce the described issue, testing it with our latest official version, but unfortunately without having any success. I am attaching my project for your reference. Would you please confirm whether I am not missing something? What exactly do you mean by saying: "However, once i end edit mode, and try to save, it gives me a NULL field."?  Meanwhile, a running sample project that illustrates this problem would be highly appreciated, or at least some more info on your scenario.

    All the best,
    Ivan Ivanov
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Andreas
    Andreas avatar
    8 posts
    Member since:
    Jul 2012

    Posted 22 Feb 2012 Link to this post

    Hello All!

    It seems if we understood correctly, we have the same issue with the DataFormComboBoxField:

    We bound it in this way:

                            <telerik:DataFormComboBoxField Grid.Column ="0" Grid.Row="4" Label="Dokumenttyp"  
                                 ItemsSource="{Binding Path=DataContext.DocumentTypes,Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadDataForm}}}"
                                 DataMemberBinding="{Binding SelectedDocumentType, Mode=TwoWay}"
                                 DisplayMemberPath="Name"
                                 SelectedValuePath="Value">
                            </telerik:DataFormComboBoxField>
    
    We are able to select an Item in the ComboBox,
    The SelectedDocumentType field is filled correctly with the "Value"
    When pressing the "OK" Button immediate the bound property "SelectedDocumentType" is set to null...

    Are we missing somthing in the binding?

    Thanks!
    Andreas Eibegger
  5. Andreas
    Andreas avatar
    8 posts
    Member since:
    Jul 2012

    Posted 22 Feb 2012 Link to this post

    Hello!

    after investigating a little bit more we found out that if we use different DataTemplates for the DataForm (For Readonly and Edit)
    then it does not work, if we use only one DataTemplate it works.

    BR!
    Andreas
  6. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 24 Feb 2012 Link to this post

    Hi Andreas,

    Would you please send us a runnable project that reproduces this issue, so that we could debug it on our side and give you an appropriate solution?

    Regards,
    Ivan Ivanov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  7. bbakermai
    bbakermai avatar
    2 posts
    Member since:
    Aug 2006

    Posted 03 Apr 2012 Link to this post

    I have the same issue trying to do this in an MVVM context. I am using a TextBox with a value converter in the ReadOnly mode template and a RadComboBox in the Edit/New template. Below is sample markup from the DataForm and its EditTemplate (the DataContext of the DataForm is the selected item from a RadDataGrid, and so the ItemsSource of the lookup data in the ComboBox must be connected to the parent DataContext, which is a ViewModel class). When I am editing and changing values, the value in the parent grid changes, but when I press either OK or Cancel from edit mode, the ComboBox's selected item's ValuePath returned to the grid's selected item is null, and so that column clears in the grid. The data source remains unaffected.

    Here's the form itself:

    <telerik:RadDataForm x:Name="radDataForm1" 
    CurrentItem
    ="{Binding SelectedItem, ElementName=gridViewChartOfAccounts, Mode=TwoWay}"
    Header
    ="{Binding SelectedItem.Name, ElementName=gridViewChartOfAccounts}"
    Background
    ="Transparent"
    AutoCommit
    ="False"
    AutoGenerateFields
    ="False"
    LabelPosition
    ="Beside"
    CommandButtonsVisibility
    ="All"
    UseLayoutRounding
    ="True"
    ReadOnlyTemplate
    ="{StaticResource GLFormTemplate}"
    EditTemplate
    ="{StaticResource GLEditTemplate}"
    NewItemTemplate
    ="{StaticResource GLEditTemplate}">

    And the DataFormComboBox from the Edit Template:

    <telerik:DataFormComboBoxField Grid.Column="0" Grid.Row="2" Label="Account Type:" 
    ItemsSource
    ="{Binding ElementName=ChartOfAccountsControl, Path=DataContext.GLAccountClasses}"                                 DisplayMemberPath="AccountType" SelectedValuePath="GLAccountClass_ID" 
    LabelPosition
    ="Above"                                DataMemberBinding="{Binding GLAccountClass_ID, Mode=TwoWay}"/>
    I'd also like to know how to set the CommandButtonsVisibility to a combination of enum values...
  8. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 04 Apr 2012 Link to this post

    Hello Bob,

    As it would be very difficult for us to prepare a full-blown project only having a XAML snippet, I would kindly ask you to send us a runnable sample, which we would be able to test on our side. As for the CommandButtonsVisibility property, the DataFormCommandButtonsVisibility type is a flagged enum, so that you can perform bitwise operations on them, like introduced in this article.

    Regards,
    Ivan Ivanov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  9. Rick Feuer
    Rick Feuer avatar
    10 posts
    Member since:
    Apr 2008

    Posted 23 Jul 2012 Link to this post

    There is definately a bug using the DataFormComboField. I am having the exact issue as described above. The gender field actually gets changed, but my grid value that it is bound to get assigned null.  If i use a dataformDataField in place, the problem does not exist. My field is a simple collection of strings. I am using the latest version of the wpf dll's

    <telerik:DataFormComboBoxField DataMemberBinding="{Binding Gender,Mode=TwoWay}"
    ItemsSource
    ="{StaticResource Genders}"
    Label
    ="Gender"
    IsEnabled
    ="True" />

  10. Vera
    Admin
    Vera avatar
    263 posts

    Posted 25 Jul 2012 Link to this post

    Hi Rick,

     
    Unfortunately, we were not able to reproduce the reported problem using the details you provided. May I ask you to open a support ticket and to send a simple runnable project demonstrating the issue? Please take a look at this blog post for a reference on how to isolate it in a sample project.

    Thank you in advance.

    All the best,
    Vera
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  11. Aleks
    Aleks avatar
    4 posts
    Member since:
    Nov 2011

    Posted 21 Sep 2012 Link to this post

    I came across the same issue and ended up in this topic. Since I could not find a solution, I sent in a support ticket with a sample project.

    Ivan provided a solution that worked. I am posting it here for anyone else that comes across the same issue and can not find the solution. 

    <telerik:DataFormDataField Label="Role: ">
          <telerik:RadComboBox SelectedItem="{Binding Role}" ItemsSource="{Binding ItemList, Source={StaticResource RoleDAL}}"  DisplayMemberPath="Name" />
    </telerik:DataFormDataField>


    Sorry about grave digging...

    -Aleks
Back to Top
UI for WPF is Visual Studio 2017 Ready