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

Combobox datatemplate

5 Answers 130 Views
GridView
This is a migrated thread and some comments may be shown as answers.
ABECON Groep BV
Top achievements
Rank 1
ABECON Groep BV asked on 31 May 2010, 02:35 PM
Hello i'm trying to get a column edit template.
So i use the code to load a datatemplate

 


string
strTemplate = @"<DataTemplate xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"" xmlns:telerikInput=""clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input"" >

 

<telerikInput:RadComboBox >

<telerikInput:RadComboBoxItem Content=""No""></telerikInput:RadComboBoxItem>

<telerikInput:RadComboBoxItem Content=""Yes""></telerikInput:RadComboBoxItem>

</telerikInput:RadComboBox>

</DataTemplate>"

 

;

 

 

 

return (DataTemplate)XamlReader.Load(strTemplate);

It loads but the selected value doesn't return to the ColumnCell and the Databinding isn't working.
I found an example project about multiple columns but i get the same problem there.

Can you help me with this problem?
Thanks
Marcel de Groot
Abecon

 

5 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 02 Jun 2010, 02:35 PM
Hello ABECON Groep BV,

At a first glance I see that your XAML does not include any binding , so nothing will bind the RadComboBox to the underlying value.

Another thing that bothers me is the approach with setting the template in code behind.

Can you please give me more details on the final behaviour you are trying to achieve along with the relevant requirements and I am sure we can think of a better way.

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
ABECON Groep BV
Top achievements
Rank 1
answered on 03 Jun 2010, 08:03 AM

Hello, indeed i want to databind but if i put the databinding in my template it gives an error.
I did the same load trick with the datapicker and that DOES work.

What i want to achieve is on my binded datagrid to set a column template. The columns are created on bind.

This specific column has to have a combobox with values "Yes" and "No"
I can add this column to by markup but the column still can't seem to get the databinding working.

I worked arround it by getting the value on CellEditEnded from the childcontrol.
((RadComboBoxItem)((RadComboBox)((Telerik.Windows.Controls.GridView.GridViewEditorPresenter)e.Cell.Content).Content).SelectedItem).Content.ToString();

 

 

But ofcourse i want it to work without doing something else.

0
Pavel Pavlov
Telerik team
answered on 08 Jun 2010, 09:56 AM
Hello ABECON Groep BV,

Form your code I asume you set the template only to get the YES/No options in the combo .
If this is the case , a much simplier way would be not to use template at all.

You can just set the itemssource of the combo column to a list of two strings - Yes and No and leave the default binding to do the work .
Let me know in case yuo need a small sample on this.


Sincerely yours,
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
varsha Motwani
Top achievements
Rank 1
answered on 08 Jun 2010, 10:49 AM
Hi,
I am also stuck up implementing same scenario.Can you please let me know wher are you setting the item source for the RadComboBox
0
Pavel Pavlov
Telerik team
answered on 08 Jun 2010, 12:14 PM
Hi,

Attached is a sample demonstating a good approach to the problem .

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.
Tags
GridView
Asked by
ABECON Groep BV
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
ABECON Groep BV
Top achievements
Rank 1
varsha Motwani
Top achievements
Rank 1
Share this question
or