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

GridViewComboBoxColumn is blank until you click in it

32 Answers 817 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Geoff Hardy
Top achievements
Rank 1
Geoff Hardy asked on 18 Mar 2010, 04:42 PM
We are using the 2010 Q1 release of the RadGridView and have noticed a problem with the GridViewComboBoxColumn. A column of this type starts out showing blank, even though the property it is bound to has a valid value. When the user clicks in the cell, the ComboBox is displayed. When the user clicks out of the cell, the value is displayed in the cell.

Our column is defined as follows:

<Controls:GridViewComboBoxColumn Header="Product" DataMemberBinding="{Binding ProductId,Mode=TwoWay}" DisplayMemberPath="Name" SelectedValueMemberPath="Id"   
Width="200" ItemsSourceBinding="{Binding Products,Source={StaticResource lookup}}"/>    

The style of our RadGridView is as follows:
                
    <Style TargetType="Controls2:RadGridView" BasedOn="{StaticResource frameworkElementStyle}">  
        <Setter Property="ActionOnLostFocus" Value="CommitEdit"/>  
        <Setter Property="AutoExpandGroups" Value="False"/>  
        <Setter Property="AutoGenerateColumns" Value="False"/>  
        <Setter Property="CanUserFreezeColumns" Value="False"/>  
        <Setter Property="CanUserInsertRows" Value="False"/>  
        <Setter Property="CanUserSortColumns" Value="False"/>  
        <Setter Property="EditTriggers" Value="CellClick"/>  
        <Setter Property="GridLinesVisibility" Value="Vertical"/>  
        <Setter Property="IsFilteringAllowed" Value="False"/>  
        <Setter Property="RowDetailsVisibilityMode" Value="VisibleWhenSelected"/>  
        <Setter Property="RowIndicatorVisibility" Value="Collapsed"/>  
        <Setter Property="SelectionMode" Value="Single"/>  
        <Setter Property="ShowColumnFooters" Value="False"/>  
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>  
        <Setter Property="ShowGroupPanel" Value="False"/>  
        <Setter Property="TabNavigation" Value="Cycle"/>  
        <Setter Property="RowDetailsStyle">  
            <Setter.Value> 
                <Style TargetType="GridView:DetailsPresenter">  
                    <Setter Property="Background" Value="{StaticResource panelBrush}"/>  
                </Style> 
            </Setter.Value> 
        </Setter> 
        <Setter Property="GroupRowStyle">  
            <Setter.Value> 
                <Style TargetType="GridView:GridViewGroupRow">  
                    <Setter Property="Background" Value="{StaticResource panelBrush}"/>  
                </Style> 
            </Setter.Value> 
        </Setter>          
    </Style> 
 

32 Answers, 1 is accepted

Sort by
0
Geoff Hardy
Top achievements
Rank 1
answered on 18 Mar 2010, 06:50 PM
This problems appears to be related to the fact that the ItemsSource for the ComboBox is loaded from the web service asyncronously as follows:

        public IList<ProductDto> Products  
        {  
            get 
            {  
                if (_products == null)  
                {  
                    ServiceWrapper.LoadProducts((products) => Products = products);  
                }  
                return _products;  
            }  
            set 
            {  
                _products = value;  
                RaisePropertyChanged("Products");  
            }  
        } 

The ComboBox does not seem to detect that the Products has changed and hence does not update its ItemsSource once the Products have been loaded.

Should the cell be able to notice that the ItemsSource has changed and update itself to show the correct value?
0
Pavel Pavlov
Telerik team
answered on 23 Mar 2010, 12:37 PM
Hello Geoff Hardy,

So far the ComboBox column does not support changing ItemsSource on-the fly . We are going to reconsider this behavior  for future versions so scenarios like yours can be covered.

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
Geoff Hardy
Top achievements
Rank 1
answered on 24 Mar 2010, 11:58 PM
As you might expect, the RadComboBox has the same issue as the GridViewComboBoxColumn. This shows up when we have a combo box that is bound to a list. The user wants to choose an item that is not in the list, so they go to another window and create a new item. The list of items is updated to include the new item, but the combobox does not pick up on this change.

It would be very useful if the comboboxes would update when their underlying ItemsSource gets updated as well. I suspect the workaround for this problem will be that I will need to manually update the ItemsSource for the combobox when the list changes. This is not ideal since we are doing using MVVM which relies on the model not knowing about the view. 

Is there another workaround for this issue?
0
Pavel Pavlov
Telerik team
answered on 30 Mar 2010, 03:56 PM
Hello Geoff Hardy,


This problem will be fixed soon  - we are already working on improvement of the combobox column . Meanwhile the only workaround i can think of would be to use GridViewDataColumn instead and place a ComboBox inside the CellTemplate.

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
Dan
Top achievements
Rank 1
answered on 22 Apr 2010, 02:45 PM
Hello,

I'm experiencing the same problem, is there any update on a solution?  If not, would you please show me a quick sample of how to use a ComboBox inside the CellEditTemplate that binds to a different datasource than the grid (in my case, a list of custom objects)?

Thanks so much,

Lars Solberg
0
Pavel Pavlov
Telerik team
answered on 28 Apr 2010, 01:49 PM
Hello Lars Solberg,

Please find the sample attached.

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
Geoff Hardy
Top achievements
Rank 1
answered on 28 May 2010, 11:26 PM
Did this ever get fixed?
0
Sam
Top achievements
Rank 1
answered on 01 Jun 2010, 03:48 PM
did anything happen with this?
0
Pavel Pavlov
Telerik team
answered on 02 Jun 2010, 03:03 PM
Hi guys,

A service pack release is being prepared right now  and will be available soon  for download in your client.net accounts.
The latest binaries include a logic to refresh the cells whenever the underlying ItemsSource has been changed.

Best wishes,
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
Geoff Hardy
Top achievements
Rank 1
answered on 02 Jun 2010, 10:01 PM
A fix for this would be great - any idea what the time frame will be for getting this new version released?
0
Vlad
Telerik team
answered on 03 Jun 2010, 06:50 AM
Hi,

The release will be most probably Today.

Sincerely yours,
Vlad
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
Juliana
Top achievements
Rank 1
answered on 30 Jun 2010, 03:28 PM
Hello, I have the same problem. Was it fixed?
0
Milan
Telerik team
answered on 30 Jun 2010, 03:39 PM
Hi Juliana,

I believe this issue was resolves a couple of weeks ago.


Sincerely yours,
Milan
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
Juliana
Top achievements
Rank 1
answered on 01 Jul 2010, 05:13 PM
Hello!
I could not resolve a problem: GridViewComboBoxColumn is blank until I click in it. I use dll's version 2010.1.603.1040.
RadGridView is define in the MainPage.xaml  as follows :
<telerikGridView:RadGridView   
            x:Name="gridView" 
            AutoGenerateColumns="False" 
            IsReadOnly="False" 
            ItemsSource="{Binding ContactInformationList}" 
            ShowGroupPanel="False" 
            CanUserFreezeColumns="False" > 
            <telerikGridView:RadGridView.Columns> 
                 <telerikGridView:GridViewComboBoxColumn   
                       Header="State" 
                       DataMemberBinding="{Binding StateID, Mode=TwoWay}" 
                       UniqueName="State" 
                       ItemsSource="{Binding StateList}" 
                       SelectedValueMemberPath="RecordID" 
                       DisplayMemberPath="Name" /> 
            </telerikGridView:RadGridView.Columns> 
        </telerikGridView:RadGridView> 
This is my MainPage.xaml.cs:
public partial class MainPage : UserControl,INotifyPropertyChanged 
    { 
        GridViewComboBoxColumn_App.Web.TestDomainContext _context = new Web.TestDomainContext(); 
 
        private List<GridViewComboBoxColumn_App.Web.Contact_Information> _contactInformationList = new List<Web.Contact_Information>(); 
        public List<GridViewComboBoxColumn_App.Web.Contact_Information> ContactInformationList 
        { 
            get 
            { 
                return _contactInformationList; 
            } 
            set 
            { 
                _contactInformationList = value
                NotifyPropertyChanged("ContactInformationList"); 
            } 
        } 
         
        private List<GridViewComboBoxColumn_App.Web.State> _stateList = new List<Web.State>(); 
        public List<GridViewComboBoxColumn_App.Web.State> StateList 
        { 
            get 
            { 
                return _stateList; 
            } 
            set 
            { 
                _stateList = value
                NotifyPropertyChanged("StateList"); 
            } 
        } 
         
        public MainPage() 
        { 
            InitializeComponent(); 
            this.DataContext = this; 
            LoadData(); 
        } 
 
        public void LoadData() 
        { 
            _context.Load(_context.GetStatesQuery(), 
               System.ServiceModel.DomainServices.Client.LoadBehavior.RefreshCurrent, 
               OnLoadState_Completed, null); 
            _context.Load(_context.GetContact_InformationsQuery(), 
                System.ServiceModel.DomainServices.Client.LoadBehavior.RefreshCurrent, 
               OnLoadContactInformation_Completed, null); 
        } 
 
        public void OnLoadState_Completed(System.ServiceModel.DomainServices.Client.LoadOperation<GridViewComboBoxColumn_App.Web.State> lo) 
        { 
            if (lo.Error == null && !lo.IsCanceled) 
                StateList = lo.Entities.ToList(); 
        } 
 
        public void OnLoadContactInformation_Completed(System.ServiceModel.DomainServices.Client.LoadOperation<GridViewComboBoxColumn_App.Web.Contact_Information> lo) 
        { 
            if (lo.Error == null && !lo.IsCanceled) 
                ContactInformationList = lo.Entities.ToList(); 
        } 
 
        public event PropertyChangedEventHandler PropertyChanged; 
 
        protected virtual void NotifyPropertyChanged(string propertyName) 
        { 
            if (this.PropertyChanged != null) 
            { 
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); 
            } 
        } 
    } 
I use  LinqToSqlDomainService for getting data from db. Could you help me?
Thanks.
0
Simon Störmer
Top achievements
Rank 1
answered on 02 Jul 2010, 03:38 PM
Hi Telerik,

I suffer the same problem. I have a ViewModel that exposes two ObservableCollections. One is the ItemsSource of the Grid itself (DummyDataList), the second one is the ItemsSource for the ComboBox (ComboItemList).

The code is as follows:

public class MainPageViewModel : INotifyPropertyChanged  
    {  
        private ObservableCollection<LISDummyData> m_DummyData = null;  
        private ObservableCollection<LISComboItem> m_ComboItems = null;  
 
        public MainPageViewModel()  
        {  
            ComboItemList = LISDummyDataLogic.GetComboItems();  
            DummyDataList = LISDummyDataLogic.GetData();  
 
        }  
 
        public ObservableCollection<LISDummyData> DummyDataList  
        {  
            get 
            {  
                return m_DummyData;  
            }  
            set 
            {  
                m_DummyData = value;  
                OnPropertyChanged("DummyDataList");  
            }  
        }  
 
        public ObservableCollection<LISComboItem> ComboItemList  
        {  
            get 
            {  
                return m_ComboItems;  
            }  
            set 
            {  
                m_ComboItems = value;  
                OnPropertyChanged("ComboItemList");  
            }  
        }  
 
        protected virtual void OnPropertyChanged(String PropertyName)  
        {  
            if (PropertyChanged != null)  
                PropertyChanged(thisnew PropertyChangedEventArgs(PropertyName));  
        }
        #region INotifyPropertyChanged Members  
 
        public event PropertyChangedEventHandler PropertyChanged;
        #endregion  
    } 

The data objects look like this:

public class LISComboItem : LISViewModelBase //, IConvertible  
    {  
        public int Value  
        {  
            get { return Get(() => Value); }  
            set { Set(() => Value, value); }  
        }  
        public String DisplayValue  
        {  
            get { return Get(() => DisplayValue); }  
            set { Set(() => DisplayValue, value); }  
        }  
    }  
 
      
    public class LISDummyData : LISViewModelBase  
    {  
        public String Name  
        {  
            get { return Get(() => Name); }  
            set { Set(() => Name, value); }  
        }  
        public bool Flag  
        {  
            get { return Get(() => Flag); }  
            set { Set(() => Flag, value); }  
        }  
        public DateTime Date  
        {  
            get { return Get(() => Date); }  
            set { Set(() => Date, value); }  
        }  
        public int Number  
        {  
            get { return Get(() => Number); }  
            set { Set(() => Number, value); }  
        }  
    } 

The methods Get and Set are part of our ViewModel base and do the value storage and raise the PropertyChanged event.

The XAML looks like this:

<TelerikGridView:RadGridView x:Name="TelerikGridView" Grid.Row="1" Grid.Column="1" ItemsSource="{Binding DummyDataList}" 
                                                                     AutoGenerateColumns="False" 
                                                                     > 
                <TelerikGridView:RadGridView.Columns> 
                    <TelerikGridView:GridViewDataColumn Header="Contact Name" DataMemberBinding="{Binding Name, Mode=TwoWay}" /> 
                    <TelerikGridView:GridViewComboBoxColumn  
                            Header="Combo" DataMemberBinding="{Binding Number, Mode=TwoWay}"   
                            ItemsSource="{Binding ComboItemList, Mode=TwoWay}" SelectedValueMemberPath="Value" DisplayMemberPath="DisplayValue"   
                              
                            /> 
                </TelerikGridView:RadGridView.Columns> 
                  
            </TelerikGridView:RadGridView> 

This leads to the result that if I click to the combo box column I can see all the values, if I click to a differen column all values disappear. If I click to the combo box column again the values appear again. Changes made in the column are correctly reflected in the view models.

We also use the 2010.1.603.1040 dlls.

Any help would be apreciated.

Kind Regards,

Tobias Richling.
0
Pavel Pavlov
Telerik team
answered on 06 Jul 2010, 12:54 PM
Hi Tobias Richling,

The reason for the strange behavior is in the ItemsSource binding for the combo column .
ItemsSource="{Binding ComboItemList, Mode=TwoWay}"
Although at GridView level the DataContext is your ViewModel , at cell level the DataContext is
the item in the source collection - in your case the LISDummyData.
RadGridVIew tries to find ComboItemsList  property and fails as it is not present in the LISDummyData.

To be able to bind directly to the view model from inside the cell  you should expose it as a static resource. 
This is demonstrated in the attached application. The app itself is based on your code with a few corrections of mine.

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
Greg Dickie
Top achievements
Rank 1
answered on 13 Sep 2010, 10:32 PM
Hi all,

I upgraded to the latest version today (2010.2.812.1040) and I am still seeing a blank combo box column until I click in it.  Did the fix that was released work for other people that were experiencing this issue?

Thanks,

Greg
0
Pavel Pavlov
Telerik team
answered on 14 Sep 2010, 08:29 AM
Hello Greg Duckie,


Please paste me your XAML - the one relevant to RadGridView and the combo column and the implementation of your business objects. I will check to see what has gone wrong.

Such problem may occur due to wrong setup of the combo column .

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
Trevor
Top achievements
Rank 1
answered on 14 Sep 2010, 02:25 PM
Here is the xaml for my grid.  Let me know if you need anything else.

<telerikGridView:RadGridView Grid.ColumnSpan="2" Grid.Row="1" ShowGroupPanel="False" ShowColumnFooters="True" AutoGenerateColumns="False" ItemsSource="{Binding WorkOrderItems}" Margin="0" Name="workOrderItemsDataGrid">
    <telerikGridView:RadGridView.Columns>
        <telerikGridView:GridViewDataColumn x:Name="itemIdColumn" DataMemberBinding="{Binding Path=Item.ItemId}" Header="Item" Width="Auto" IsReadOnly="True" />
        <telerikGridView:GridViewDataColumn x:Name="itemExtendedDescriptionColumn" DataMemberBinding="{Binding Path=ItemExtendedDescription}" Header="Description" Width="Auto" IsReadOnly="True" />
        <telerikGridView:GridViewDataColumn x:Name="itemReceivedQtyColumn" UniqueName="ItemReceivedQty" DataMemberBinding="{Binding Path=ItemReceivedQty}" Header="Qty" Width="Auto" DataFormatString="{} {0:#,###;-#,###;#}" TextAlignment="Right" FooterTextAlignment="Right">
            <telerikGridView:GridViewDataColumn.AggregateFunctions>
                <telerik:SumFunction ResultFormatString="{} {0:#,###;-#,###;#}" />
            </telerikGridView:GridViewDataColumn.AggregateFunctions>
        </telerikGridView:GridViewDataColumn>
        <telerikGridView:GridViewComboBoxColumn DataMemberBinding="{Binding Path=ReceiveShipUnit}" ItemsSource="{Binding ElementName=control, Path=ViewModel.ReceiveShipUnits}" DisplayMemberPath="UnitName" Header="Unit" Width="Auto" />
    </telerikGridView:RadGridView.Columns>
</telerikGridView:RadGridView>

Thanks,

Greg
0
Juliana
Top achievements
Rank 1
answered on 14 Sep 2010, 02:32 PM
Hi Greg,

Your RadCombobBoxColumn definition should be something like that
<telerikGridView:GridViewComboBoxColumn DataMemberBinding="{Binding Path=ReceiveShipUnit}" ItemsSource="{Binding ReceiveShipUnits, Source={StaticResource detailsViewModel}}" DisplayMemberPath="UnitName" Header="Unit" Width="Auto" />
    </telerikGridView:RadGridView.Columns>

where detailsViewModel is a static resource.

In my case, I define it in constructor, before InitializeComponent:

 if (App.Current.Resources.Contains("detailsViewModel"))
                App.Current.Resources.Remove("detailsViewModel");
            App.Current.Resources.Add("detailsViewModel", viewModel);

 InitializeComponent();
this.DataContext = viewModel;

hth,
Juliana
0
Trevor
Top achievements
Rank 1
answered on 14 Sep 2010, 09:57 PM
Thanks Juliana that works great!
0
Ole
Top achievements
Rank 1
answered on 21 Oct 2010, 10:42 AM
Hi ,

Just installed the latest version of RadControls for Silverlight 2010.2 924

And I still experience this problem,

<telerik:RadGridView x:Name="gridviewAuditSignal" AutoGenerateColumns="False" ItemsSource="{Binding ElementName=DDSAuditSignal, Path=Data, Mode=TwoWay}">
             <telerik:RadGridView.Columns>
                 <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=KKS1}"/>
                 <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=KKS2}"/>
                 <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=KKS1_Desc}"/>
                 <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=KKS2_Desc}"/>
                 <telerik:GridViewComboBoxColumn  ItemsSource="{Binding ElementName=DDSFunctionArea, Path=Data}" DisplayMemberPath="Function_Area1" SelectedValueMemberPath="FunctionID" DataMemberBinding="{Binding Path=FA}"></telerik:GridViewComboBoxColumn>
                 <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Display}"/>
                 <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Ready}"/>
                 <telerik:GridViewComboBoxColumn  ItemsSource="{Binding ElementName=DDSPhase, Path=Data}" DisplayMemberPath="Phase1" SelectedValueMemberPath="PhaseID" DataMemberBinding="{Binding Path=Phase}"></telerik:GridViewComboBoxColumn>
             </telerik:RadGridView.Columns>
         </telerik:RadGridView>
     </my:GroupBox>
     <riaControls:DomainDataSource x:Name="DDSAuditSignal" QueryName="GetSignalListR_DevicesQuery">
         <riaControls:DomainDataSource.DomainContext>
             <auditSignal:signalAuditDomainContext/>
         </riaControls:DomainDataSource.DomainContext>
     </riaControls:DomainDataSource>
     <riaControls:DomainDataSource x:Name="DDSFunctionArea" QueryName="GetFunction_AreasQuery" >
         <riaControls:DomainDataSource.DomainContext>
             <auditSignal:signalAuditDomainContext/>
         </riaControls:DomainDataSource.DomainContext>
     </riaControls:DomainDataSource>
     <riaControls:DomainDataSource x:Name="DDSPhase" QueryName="GetPhasesQuery">
         <riaControls:DomainDataSource.DomainContext>
             <auditSignal:signalAuditDomainContext/>
         </riaControls:DomainDataSource.DomainContext>
     </riaControls:DomainDataSource>

The combobox columns start up empty, but clicking a cell in the column the all the the values for that column appers.

Any solution for this ?.

Best Ole
0
Juliana
Top achievements
Rank 1
answered on 21 Oct 2010, 03:15 PM
Hi Ole,

You can set the ItemsSource of the combo column in code behind instead of binding it in XAML:

private void DDSFunctionArea_LoadedData(object sender, LoadedDataEventArgs e)
{
if (!e.Cancelled && !e.HasError)
    (gridView.Columns[
"Phase"] as GridViewComboBoxColumn).ItemsSource =e.Entities;
}

Greetings,
Juliana

0
Pavel Pavlov
Telerik team
answered on 22 Oct 2010, 08:16 AM
Hi Ole,

There cause of the trouble is you are trying to use element name binding as ItemsSource for the combo column .

Please use binding to a static resource instead or set the ItemsSource in code behind as suggested.

Due to the virtualization mechanism implemented in RadGridView , ElementNameBindings at cell level are not reliable as the element would not always be aware of the namescope.

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
Ole
Top achievements
Rank 1
answered on 22 Oct 2010, 04:19 PM
Hi everyone.

Got things working using the suggestion from Juliana.

Thanks and have a nice weekend..

Best Ole
0
Allister
Top achievements
Rank 1
answered on 23 Nov 2010, 05:34 PM
I really think this is a bug. All the explanations point to 'workarounds' in CodeBehind's.
However the simple fact is that until you click the column, no data is shown.

If <telerik:GridViewComboBoxColumn ItemsSource="{Binding Path=Data, Mode=TwoWay, ElementName=projectTypeDomainDataSource}" is incorrect.
Please suggest how (through the XAML), we should use the GridViewComboBoxColumn with a DomainDataSource.

Here is my example:

<riaControls:DomainDataSource LoadedData="projectDomainDataSource_LoadedData" Name="projectDomainDataSource" AutoLoad="True" Height="0" QueryName="GetProjectsByUserQuery" Width="0">
            <riaControls:DomainDataSource.DomainContext>
                <my:ProjectDomainContext/>
            </riaControls:DomainDataSource.DomainContext>
        </riaControls:DomainDataSource>
        <riaControls:DomainDataSource LoadedData="projectTypeDomainDataSource_LoadedData" Name="projectTypeDomainDataSource" AutoLoad="True" Height="0" QueryName="GetProjectTypesQuery" Width="0">
            <riaControls:DomainDataSource.DomainContext>
                <my:ProjectDomainContext/>
            </riaControls:DomainDataSource.DomainContext>
        </riaControls:DomainDataSource>
            <telerik:RadGridView ItemsSource="{Binding ElementName=projectDomainDataSource, Path=Data}"
                                 IsBusy="{Binding IsBusy, ElementName=projectDomainDataSource}"
                                 DataLoadMode="Asynchronous"
                                 DataContext="{Binding ElementName=projectDomainDataSource, Path=Data, Mode=TwoWay}"
                                 Margin="0,15,0,0" Background="Black" Width="800" Height="600" Name="RadGridView1"
                                 AutoGenerateColumns="False" EnableColumnVirtualization="True" ShowGroupPanel="False" ShowInsertRow="True" CanUserInsertRows="True" >
                <telerik:RadGridView.Columns>
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Id}" Header="Project Id" />
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Header="Project Name" />
                    <telerik:GridViewComboBoxColumn ItemsSource="{Binding Path=Data, Mode=TwoWay, ElementName=projectTypeDomainDataSource}" DataMemberBinding="{Binding ProjectTypesId}" UniqueName="PT" SelectedValueMemberPath="Id" DisplayMemberPath="Name" Header="Project Type"/>
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>
0
Pavel Pavlov
Telerik team
answered on 24 Nov 2010, 09:03 AM
Hi Kevin,

Place the projectTypeDomainDataSource in a static resource and use Binding to Static resource instead of element name binding.

This should fix the problem .

Regards,
Pavel Pavlov
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Jonx
Top achievements
Rank 2
answered on 27 Feb 2011, 08:36 PM
Hello Pavel,
It's working thanks.

I just add this for the record...

GridViewComboBoxColumn MVVM:
<UserControl.Resources>
    <app:MeetingViewModel x:Key="MeetingViewModel"/>
</UserControl.Resources>

the GridView:
<telerik:RadGridView x:Name="grdMeetingList" ItemsSource="{Binding View}" IsBusy="{Binding IsBusy}" AutoGenerateColumns="False">
            <telerik:RadGridView.Columns>
                <telerik:GridViewComboBoxColumn ItemsSourceBinding="{Binding Conseillers, Mode=TwoWay, Source={StaticResource MeetingViewModel}}" DataMemberBinding="{Binding Path=Conseiller, Mode=TwoWay}" UniqueName="Conseiller" Header="Conseiller" EditTriggers="CellClick"></telerik:GridViewComboBoxColumn>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>

View, IsBusy, Conseillers being properties of my view model.
Conseiller being a field of the entity found in my View collection.

John. 
0
Gio
Top achievements
Rank 1
answered on 24 Nov 2011, 03:57 PM
Resolved without static resource, but with cellTemplate.
This template is used only for view data, while on edit is used the combo box.


<tlk:GridViewComboBoxColumn Header="Categoria"
    ItemsSource="{Binding Path=EntitiesAdditional[Categorie], Mode=TwoWay}"
    DataMemberBinding="{Binding Path=Categorie, Mode=TwoWay}"
    DisplayMemberPath="Nome" >
        <tlk:GridViewColumn.CellTemplate>
            <DataTemplate>
                <TextBlock Text="{Binding Categorie.Nome}"></TextBlock>
            </DataTemplate
        </tlk:GridViewColumn.CellTemplate>
</tlk:GridViewComboBoxColumn>
0
Juliana
Top achievements
Rank 1
answered on 25 Nov 2011, 07:44 AM
Hi Gio,
Could you share your object structure?
0
Atif
Top achievements
Rank 1
answered on 26 Nov 2011, 06:00 AM
0
Muhammad
Top achievements
Rank 1
answered on 17 Aug 2013, 11:11 AM
great solution
Tags
GridView
Asked by
Geoff Hardy
Top achievements
Rank 1
Answers by
Geoff Hardy
Top achievements
Rank 1
Pavel Pavlov
Telerik team
Dan
Top achievements
Rank 1
Sam
Top achievements
Rank 1
Vlad
Telerik team
Juliana
Top achievements
Rank 1
Milan
Telerik team
Simon Störmer
Top achievements
Rank 1
Greg Dickie
Top achievements
Rank 1
Trevor
Top achievements
Rank 1
Ole
Top achievements
Rank 1
Allister
Top achievements
Rank 1
Jonx
Top achievements
Rank 2
Gio
Top achievements
Rank 1
Atif
Top achievements
Rank 1
Muhammad
Top achievements
Rank 1
Share this question
or