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

Another, GridViewComboBoxColumn dropdown arrow always visible, question

4 Answers 141 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 12 Oct 2015, 02:01 PM

We are currently using a GridViewComboBoxColumn control in a GridView, and like a few others, we would like the combobox editor (arrow) to always be visible. Most answers have involved using the said 'GridViewComboBoxColumn' or a 'GridViewDataColumn' in conjunction with a DataTemplate to target the ComboBox. 

 I have both approaches, both with the same result. I get a column of combo boxes, but no data.

This is our current markup:

 

<telerik:GridViewComboBoxColumn x:Name="ColP4" Width="150" IsReadOnly="False" IsComboBoxEditable="False" EditTriggers="CellClick" ItemsSource="{Binding PermissionCollection}" DataMemberBinding="{Binding Col4}" UniqueName="Permission" Header="{Binding Source={StaticResource TranslationAreas}, Path=[exportproject][TXT_COLUMN_5]}" DisplayMemberPath="Name" SelectedValueMemberPath="ID"/>

ItemsSource is an ObservableCollection of type 'Permission'. Permission has two properties, int: ID and str: Name.  

 This looks like what we want, only with no data:

 

<telerik:GridViewDataColumn x:Name="ColP4"
      DataMemberBinding="{Binding Col4}"
      Header="{Binding Source={StaticResource TranslationAreas}, Path=[exportproject]
          [TXT_COLUMN_5]}" >
      <telerik:GridViewColumn.CellTemplate>
          <DataTemplate>
              <ComboBox DisplayMemberPath="Name"
                        ItemsSource="{Binding PermissionCollection}"
                        SelectedValue="ID"
                        SelectedValuePath="ID"/>
           </DataTemplate>
       </telerik:GridViewColumn.CellTemplate>
</telerik:GridViewDataColumn>

 

 I'm sure the problem lies with the databinding. Any help is very much appreciated.

4 Answers, 1 is accepted

Sort by
0
Robert
Top achievements
Rank 1
answered on 12 Oct 2015, 02:21 PM
Correction: ItemsSource is an ObservableItemCollection<Permission>
0
Stefan
Telerik team
answered on 15 Oct 2015, 08:51 AM
Hi Robert,

A similar issue is discussed in the Empty Cells in Combobox column topic. Can you please take a look at it and let me know whether it corresponds to the problem you are experiencing?

Additionally, you can take a look at the ComboBox Column documentation article.

I hope this helps.

Best Regards,
Stefan
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Robert
Top achievements
Rank 1
answered on 21 Oct 2015, 11:57 AM

Thanks for your reply Stefan.

The solution for us was to set the ComboBox.ItemsSource to RelativeSource FindAncestor (the GridView):

                             

<telerik:GridViewDataColumn x:Name="ColP41"
    Width="150"
    UniqueName="Permission"
    Header="{Binding Source={StaticResource TranslationAreas}, Path=[exportproject][TXT_COLUMN_5]}"
    DataMemberBinding="{Binding Col4}">
    <telerik:GridViewDataColumn.CellTemplate>
      <DataTemplate>
        <telerik:RadComboBox SelectedValuePath="ID"
          DisplayMemberPath="Name"
          SelectedValue="{Binding Col4}"
          ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor,
            AncestorType={x:Type telerik:RadGridView}},
            Path=DataContext.PermissionCollection}">
        </telerik:RadComboBox>
      </DataTemplate>
    </telerik:GridViewDataColumn.CellTemplate><br>                              </telerik:GridViewDataColumn>​

0
Stefan
Telerik team
answered on 22 Oct 2015, 01:51 PM
Hello Robert,

I am glad that you have found a resolution to this issue.

Do not hesitate to contact us should you have any other questions on our controls.

Regards,
Stefan
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
Robert
Top achievements
Rank 1
Answers by
Robert
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or