8 Answers, 1 is accepted
0
Hello madladuk,
Hope this helps.
Greetings,
Veselin Vasilev
the Telerik team
CAUSE
Probably you use ElementName binding for that column, e.g.
<telerik:GridViewComboBoxColumn Header="Category"
DataMemberBinding="{Binding CategoryID}" ItemsSource="{Binding Path=DataContext.Categories, ElementName=RootElement}" DisplayMemberPath="CategoryName" SelectedValueMemberPath="CategoryID" /> |
This will not work, as the DataContext of the cell would not be the ViewModel, but the business object related to the row instead. We do not recommend such approach.
SOLUTION
There are two ways of solving the issue :
1. Expose the ViewModel as a static resource on the page so that it can be easily accessible by the binding:
<UserControl.Resources>
<local:MainPageViewModel x:Key="mainPageViewModel" /> </UserControl.Resources> ... <telerik:GridViewComboBoxColumn Header="Category" DataMemberBinding="{Binding CategoryID}" ItemsSource="{Binding Path=Categories, Source={StaticResource mainPageViewModel}}" DisplayMemberPath="CategoryName" SelectedValueMemberPath="CategoryID" /> |
OR
2. Set the ItemsSource of the combo column in code behind instead of binding it in XAML:
private void gridView_DataLoaded(object sender, EventArgs e)
{ (gridView.Columns["Category"] as GridViewComboBoxColumn).ItemsSource = GetCategories(); } |
Hope this helps.
Greetings,
Veselin Vasilev
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

madladuk
Top achievements
Rank 2
answered on 16 Aug 2010, 02:08 PM
Hi, sorry I dont quite understand. On my page I have the domain data source setup which gets an entity called "data_PERSON" this has sub records called "data_DEPENDANT". On the page I have two user controls, the first shows the radgrid with the list of the "data_DEPENDANTs" so the ItemSource of the grid is {Binding Path=data_DEPENDANT} and the combobox is wired up to the domaindatasource in the user control to show the relationship type "picklist_RELATIONSHIP";
So I find that the values in the comobox only show when you click the combobox.
Second problem I have is in the second user control on the page I need this to show the "data_DEPENDANT" for the record selected in the radgrid, i tried setting the DataContext in the second user control to {Binding Path=data_DEPENDANT.CurrentItem} and the masked textbox to Value={Binding Path=Name} but this does not return any information when a record is selected.
Could you assist?
Thanks P
<
telerik:GridViewComboBoxColumn
Header
=
"Relationship Type"
SelectedValueMemberPath
=
"rowguid"
DisplayMemberPath
=
"picktext"
DataMemberBinding
=
"{Binding Path=relationship, Mode=TwoWay}"
ItemsSource
=
"{Binding Data, ElementName=dds}"
/>
So I find that the values in the comobox only show when you click the combobox.
Second problem I have is in the second user control on the page I need this to show the "data_DEPENDANT" for the record selected in the radgrid, i tried setting the DataContext in the second user control to {Binding Path=data_DEPENDANT.CurrentItem} and the masked textbox to Value={Binding Path=Name} but this does not return any information when a record is selected.
Could you assist?
Thanks P
0

madladuk
Top achievements
Rank 2
answered on 16 Aug 2010, 02:09 PM
The element "dds" is coming from the page hosting the usercontrol
0
Hello madladuk,
Please try setting the ItemsSource of the combobox column in the code behind. That should fix the first problem.
As for the second one - please set the IsSynchronizedWithCurrentItem property of RadGridView to True.
Greetings,
Veselin Vasilev
the Telerik team
Please try setting the ItemsSource of the combobox column in the code behind. That should fix the first problem.
As for the second one - please set the IsSynchronizedWithCurrentItem property of RadGridView to True.
Greetings,
Veselin Vasilev
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

madladuk
Top achievements
Rank 2
answered on 16 Aug 2010, 03:09 PM
Thanks, i set the IsSynchronizedWithCurrentItem on the grid, however I dont see any data in the second user control;
Thanks P{
<
Grid
Margin
=
"10,10,30,10"
DataContext
=
"{Binding Path=data_DEPENDANT.CurrentItem}"
>
<
StackPanel
Orientation
=
"Vertical"
>
<
StackPanel
HorizontalAlignment
=
"Stretch"
VerticalAlignment
=
"Top"
Orientation
=
"Horizontal"
Margin
=
"0,1,0,0"
>
<
TextBlock
Text
=
"Name"
Width
=
"120"
VerticalAlignment
=
"Center"
/>
<
telerikInput:RadMaskedTextBox
MaskType
=
"None"
Width
=
"220"
Grid.Column
=
"1"
telerik:StyleManager.Theme
=
"Windows7"
Value
=
"{Binding Path=name}"
/>
</
StackPanel
>
Thanks P{
0
Hi madladuk,
I suggest that you open a new support ticket and attach a sample project demonstrating the issue there. That will help us identify where the problem is and find a solution easier.
Thanks
Kind regards,
Veselin Vasilev
the Telerik team
I suggest that you open a new support ticket and attach a sample project demonstrating the issue there. That will help us identify where the problem is and find a solution easier.
Thanks
Kind regards,
Veselin Vasilev
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

madladuk
Top achievements
Rank 2
answered on 18 Aug 2010, 02:21 PM
Where is GetCategories() coming from? I have a rai datasource within the page named "dds" however if I set the itemsource to dds.data or dds.dataview the page gets an error?
Thanks
P
Thanks
P
0
Hi madladuk,
It is just a name of a sample method which returns the data that should be shown in the combobox.
It could be any method that returns IEnumerable.
Sincerely yours,
Veselin Vasilev
the Telerik team
It is just a name of a sample method which returns the data that should be shown in the combobox.
It could be any method that returns IEnumerable.
Sincerely yours,
Veselin Vasilev
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