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

Templated DataFormData

3 Answers 133 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Ivan
Top achievements
Rank 1
Ivan asked on 25 Nov 2011, 02:26 AM
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.

3 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 25 Nov 2011, 07:50 AM
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 >>

0
Ivan
Top achievements
Rank 1
answered on 28 Nov 2011, 08:53 PM
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?
0
Maya
Telerik team
answered on 01 Dec 2011, 02:49 PM
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 >>

Tags
DataForm
Asked by
Ivan
Top achievements
Rank 1
Answers by
Maya
Telerik team
Ivan
Top achievements
Rank 1
Share this question
or