Templated DataFormData

4 posts, 0 answers
  1. Ivan
    Ivan avatar
    9 posts
    Member since:
    Dec 2010

    Posted 24 Nov 2011 Link to this post

    Hello.

    I was wondering how could I have a DataFormDataField or DataFormComboBox which could let me have a selection control(ComboBox or DropDownButton) which had a GridView in the dropdown list, so I can filter and group the information, and keeping the label of this dataformdatafield.
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 25 Nov 2011 Link to this post

    Hello Ivan,

    You can place a RadComboBox directly in DataFormDataField and place RadGridView inside this RadComboBox's Template. It could be something like follows:

    <telerik:DataFormComboBoxField  >
                        <telerik:RadComboBox>
                            <telerik:RadComboBox.Template>
                                <ControlTemplate>
                                    <telerik:RadGridView />
                                </ControlTemplate>
                            </telerik:RadComboBox.Template>
                        </telerik:RadComboBox>
                    </telerik:DataFormComboBoxField>

     

    Kind regards,
    Maya
    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. Ivan
    Ivan avatar
    9 posts
    Member since:
    Dec 2010

    Posted 28 Nov 2011 Link to this post

    Hello, thanks for the quick reply.

    I've already replaced the DataFormComboBoxField with the new RadComboBox, which is working alright, but it still shows the dropdown list it displayed before.

    I replaced this line

    <telerik:DataFormComboBoxField Name="DataCB" DataMemberBinding="{Binding DataId}"
                                  Label="Data" Loaded="DataCB_Loaded" SelectedValuePath="Id" />

    with these

    <telerik:DataFormComboBoxField Name="DataCB" Label="Data">
      <telerik:RadComboBox Loaded="DataCB_Loaded" SelectedValuePath="Id" SelectedValue="{Binding DataId}">
        <telerik:RadComboBox.Template>
          <ControlTemplate TargetType="telerik:RadComboBox">
            <
    telerik:RadGridView ItemsSource="{TemplateBinding ItemsSource}" Height="200" AutoGenerateColumns="False">
              <
    telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Property1}" />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Property2}" />
              </telerik:RadGridView.Columns>
            </telerik:RadGridView>
          </ControlTemplate>
        </telerik:RadComboBox.Template>
      </telerik:RadComboBox>
    </telerik:DataFormComboBoxField>

    and the RadComboBox's controltemplate is ignored.

    Could you be a little more specific on how to replace the list with the RadGridView?
  5. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 01 Dec 2011 Link to this post

    Hi Ivan,

    I have tested the scenario with setting DataFormComboBoxField as follows:

    <telerik:DataFormComboBoxField >               
        <telerik:DataFormComboBoxField.ContentTemplate>
            <DataTemplate>
                <telerik:RadComboBox >
                    <telerik:RadComboBox.Template>
                        <ControlTemplate>
                            <telerik:RadGridView />
                        </ControlTemplate>
                    </telerik:RadComboBox.Template>
                </telerik:RadComboBox>
            </DataTemplate>
        </telerik:DataFormComboBoxField.ContentTemplate>
    </telerik:DataFormComboBoxField>

    and everything works as expected on my side. What are the difficulties that you encountered ? 
    Nevertheless, I would recommend you to run through this blog post for further reference and try to implement the same idea. 

    Greetings,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top