GridViewComboBoxColumn is blank until you click in it

33 posts, 0 answers
  1. Geoff Hardy
    Geoff Hardy avatar
    58 posts
    Member since:
    Feb 2010

    Posted 18 Mar 2010 Link to this post

    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> 
     
  2. Geoff Hardy
    Geoff Hardy avatar
    58 posts
    Member since:
    Feb 2010

    Posted 18 Mar 2010 Link to this post

    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?
  3. DevCraft banner
  4. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 23 Mar 2010 Link to this post

    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.
  5. Geoff Hardy
    Geoff Hardy avatar
    58 posts
    Member since:
    Feb 2010

    Posted 24 Mar 2010 Link to this post

    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?
  6. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 30 Mar 2010 Link to this post

    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.
  7. Dan
    Dan avatar
    35 posts
    Member since:
    Oct 2008

    Posted 22 Apr 2010 Link to this post

    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
  8. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 28 Apr 2010 Link to this post

    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.
  9. Geoff Hardy
    Geoff Hardy avatar
    58 posts
    Member since:
    Feb 2010

    Posted 28 May 2010 Link to this post

    Did this ever get fixed?
  10. Sam
    Sam avatar
    19 posts
    Member since:
    May 2009

    Posted 01 Jun 2010 Link to this post

    did anything happen with this?
  11. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 02 Jun 2010 Link to this post

    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.
  12. Geoff Hardy
    Geoff Hardy avatar
    58 posts
    Member since:
    Feb 2010

    Posted 02 Jun 2010 Link to this post

    A fix for this would be great - any idea what the time frame will be for getting this new version released?
  13. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 03 Jun 2010 Link to this post

    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.
  14. Juliana
    Juliana avatar
    71 posts
    Member since:
    Feb 2008

    Posted 30 Jun 2010 Link to this post

    Hello, I have the same problem. Was it fixed?
  15. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 30 Jun 2010 Link to this post

    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
  16. Juliana
    Juliana avatar
    71 posts
    Member since:
    Feb 2008

    Posted 01 Jul 2010 Link to this post

    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.
  17. Simon Störmer
    Simon Störmer avatar
    31 posts
    Member since:
    Oct 2012

    Posted 02 Jul 2010 Link to this post

    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.
  18. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 06 Jul 2010 Link to this post

    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
  19. Greg Dickie
    Greg Dickie avatar
    4 posts
    Member since:
    Sep 2005

    Posted 13 Sep 2010 Link to this post

    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
  20. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 14 Sep 2010 Link to this post

    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
  21. Greg
    Greg avatar
    48 posts
    Member since:
    Sep 2010

    Posted 14 Sep 2010 Link to this post

    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
  22. Juliana
    Juliana avatar
    71 posts
    Member since:
    Feb 2008

    Posted 14 Sep 2010 Link to this post

    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
  23. Greg
    Greg avatar
    48 posts
    Member since:
    Sep 2010

    Posted 14 Sep 2010 Link to this post

    Thanks Juliana that works great!
  24. Ole
    Ole avatar
    36 posts
    Member since:
    Aug 2010

    Posted 21 Oct 2010 Link to this post

    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
  25. Juliana
    Juliana avatar
    71 posts
    Member since:
    Feb 2008

    Posted 21 Oct 2010 Link to this post

    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

  26. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 22 Oct 2010 Link to this post

    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
  27. Ole
    Ole avatar
    36 posts
    Member since:
    Aug 2010

    Posted 22 Oct 2010 Link to this post

    Hi everyone.

    Got things working using the suggestion from Juliana.

    Thanks and have a nice weekend..

    Best Ole
  28. Allister
    Allister avatar
    1 posts
    Member since:
    Aug 2010

    Posted 23 Nov 2010 Link to this post

    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>
  29. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 24 Nov 2010 Link to this post

    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
  30. Jonx
    Jonx avatar
    258 posts
    Member since:
    Jul 2012

    Posted 27 Feb 2011 Link to this post

    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. 
  31. Gio
    Gio avatar
    6 posts
    Member since:
    Jul 2011

    Posted 24 Nov 2011 Link to this post

    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>
Back to Top
DevCraft banner