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

Extending GridViewComboBoxColumn

14 Answers 94 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Calin Calin
Top achievements
Rank 1
Calin Calin asked on 21 Jun 2010, 09:39 AM
Hi,

I am trying to extend the GridViewComboBoxColumn, here is my class:
public class ExtendedGridViewComboBoxColumn : GridViewComboBoxColumn 
    { 
        public static readonly DependencyProperty DisplayMemberProperty = DependencyProperty.Register("DisplayMember"typeof(object), typeof(ExtendedGridViewComboBoxColumn), null); 
        public object DisplayMember 
        { 
            get 
            { 
                return GetValue(DisplayMemberProperty); 
            } 
            set 
            { 
                SetValue(DisplayMemberProperty, value); 
            } 
        } 

Here is my xaml:
<CustomControls:ExtendedGridViewComboBoxColumn Header="Product" Width="150" 
                                                    SortMemberPath="ProductName" SortingState="Ascending" 
                                                    ItemsSourceBinding="{Binding Source={StaticResource productData}}" 
                                                    DataMemberBinding="{Binding Path=ProductId, Mode=TwoWay}" 
                                                    SelectedValueMemberPath="Id" 
                                                    DisplayMemberPath="ProductName" DisplayMember="{Binding Path=ProductName, Mode=TwoWay}"

When I run the application I get a AG_E_PARSER_BAD_PROPERTY_VALUE.

What am I doing wrong here ?

Thank you,

14 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 21 Jun 2010, 09:45 AM
Hi Calin Calin,

I will try to resemble the issue here in a small project. Meanwhile can you please share what is the final behavior you are trying to achieve with adding the DisplayMemberPath property. Such feedback will help me provide better assistance , and may also help our team improve the API and add anything missing which forces you to extend the column .  ( some version number details would be also helpful) .

Greetings,
Pavel Pavlov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Calin Calin
Top achievements
Rank 1
answered on 21 Jun 2010, 09:51 AM
Hi Pavel,

Thank you for your quick answer, 
Here is my scenario, I bind to the combo objects with 2 properties (Id and Name) the ValuePath will be Id the DisplayPath will be Name, the items on the grid also have 2 properties ObjectId, ObjectName. I can populate ObjectId using DataMemberBinding but there is no way from me to populate ObjectName (in xaml that is).

Thank you,
0
Pavel Pavlov
Telerik team
answered on 21 Jun 2010, 10:00 AM
Hello Calin Calin,

I believe this can be achieved without extending the combo column. I will prepare a small sample for you .  Just to be sure - can you please give me more details on what is the relation between the Name/ID and the ObjectID/ObjectName properties.

Also I am not yet sure if this is applicable to your case,  but the latest version of RadGridView supports multiple columns displayed in the combo and the cell  - meaning you can simultaneously display the ID and the Name within the cell and within the combobox items.

Kind regards,
Pavel Pavlov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Calin Calin
Top achievements
Rank 1
answered on 21 Jun 2010, 10:13 AM
Hi,

This is great news (both the sample and the new feature in the grid).
Name/Id are properties in the objects from the ItemsSource of the combo
ObjectName/ObjectId are properties in the in the objects of the ItemsSource of the grid.
I am trying to copy the values from Name/Id over to ObjectName/ObjectId.

Regards,
0
Calin Calin
Top achievements
Rank 1
answered on 22 Jun 2010, 07:09 PM
Hi Pavel,

Any luck with that sample ?

Thank you,
0
Pavel Pavlov
Telerik team
answered on 23 Jun 2010, 03:44 PM
Hi Calin Calin,

Please find the sample attached.

Kind regards,
Pavel Pavlov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Calin Calin
Top achievements
Rank 1
answered on 23 Jun 2010, 04:12 PM
Hi Pavel,

Your sample is indeed interesting, more of a work around.

You've stated that "the latest version of RadGridView supports multiple columns displayed". Is there any way to get something similar to a grid view there ?

[Combo] [TextColumn] [TextColumn1]
_Id _Name
1    First
2    Second

I need to have that header.

Thank you,
0
Pavel Pavlov
Telerik team
answered on 23 Jun 2010, 04:45 PM
Hello Calin Calin,

We can easily touch some templates to show such header. Can you specify where exactly the header should be displayed - at the top of the GridView column or  at the top of the ComboBox  ?

Greetings,
Pavel Pavlov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Calin Calin
Top achievements
Rank 1
answered on 23 Jun 2010, 04:53 PM
Hi Pavel,

At the top of the GridViewComboBoxColumn.
The point is to obtain something similar to the sample you've send me but with a header.

Regards,
0
Pavel Pavlov
Telerik team
answered on 24 Jun 2010, 04:49 PM
Hi Calin Calin,

In such case you can just set the Header property of the column . If you need more complex header , you may set the Header property to a UIElement - e.g. a Grid or StackPanel with few textblocks inside.

Kind regards,
Pavel Pavlov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Calin Calin
Top achievements
Rank 1
answered on 24 Jun 2010, 05:31 PM
Hi Pavel,

A image is a 1000 words, this is what I need:
But as a GridViewComboBox. 
How can I achieve this ?

Thank you,
0
Pavel Pavlov
Telerik team
answered on 29 Jun 2010, 10:27 AM
Hello Calin Calin,

This would require redefining the template for the combo.
Please have a look at the modified sample attached.

Greetings,
Pavel Pavlov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Calin Calin
Top achievements
Rank 1
answered on 29 Jun 2010, 12:00 PM
Hi,

Can we have a radgridview insteed of this ugly borders ?

Thanks,
0
Calin Calin
Top achievements
Rank 1
answered on 01 Jul 2010, 12:36 PM
Hi Pavel,

After some battles and thanks to your template I managed to solved my issue.

I now have a combox that has as a item panel a fully functional grid.

Unfortunately I can't upload the code here (the forum only allows uploading valid image files). If someone else needs this please pm me or leave the contact info here.

Regards,
Tags
GridView
Asked by
Calin Calin
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Calin Calin
Top achievements
Rank 1
Share this question
or