Another, GridViewComboBoxColumn dropdown arrow always visible, question

5 posts, 0 answers
  1. Robert
    Robert avatar
    9 posts
    Member since:
    Oct 2015

    Posted 12 Oct 2015 Link to this post

    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.

  2. Robert
    Robert avatar
    9 posts
    Member since:
    Oct 2015

    Posted 12 Oct 2015 Link to this post

    Correction: ItemsSource is an ObservableItemCollection<Permission>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Stefan X1
    Admin
    Stefan X1 avatar
    514 posts

    Posted 15 Oct 2015 Link to this post

    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
  5. Robert
    Robert avatar
    9 posts
    Member since:
    Oct 2015

    Posted 21 Oct 2015 in reply to Stefan X1 Link to this post

    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>​

  6. Stefan X1
    Admin
    Stefan X1 avatar
    514 posts

    Posted 22 Oct 2015 Link to this post

    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
Back to Top
UI for WPF is Visual Studio 2017 Ready