This question is locked. New answers and comments are not allowed.
I have a grid with a GridViewComboBoxColumn column both (grid and dropdown) of which are bound at runtime. The drop down column only displays the values when it is clicked. Click in any row in the GridViewComboBoxColumn column and _all_ the rows appear. Click in another cell not in this column and all the cells are cleared. Try the code below, and click in the button at the top of the page to bind the grid and see the effect:
Xaml:
Code behind:
This is SL4, using version Telerik 2010.2.924.1040 under IE 8, Windows 7 64bit.
Thanks,
Scott
Xaml:
<UserControl xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:local="clr-namespace:SL.SelectCheckbox" xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" x:Class="SL.ProgDropDown.MainPage" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"> <Grid x:Name="LayoutRoot" Background="White" > <Grid.RowDefinitions> <RowDefinition Height="20"></RowDefinition> <RowDefinition></RowDefinition> </Grid.RowDefinitions> <Button Content="Bind GridView" Click="Button_Click"></Button> <telerik:RadGridView x:Name="SampleGrid" Grid.Row="1" AutoGenerateColumns="False" ItemsSource="{Binding Items}"> <telerik:RadGridView.Columns> <telerik:GridViewComboBoxColumn DataMemberBinding="{Binding Code, Mode=TwoWay}" Header="From" SelectedValueMemberPath="Code" DisplayMemberPath="Name" ItemsSource="{Binding Path=LookupCodes}"/> <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"/> </telerik:RadGridView.Columns> </telerik:RadGridView> </Grid></UserControl>Code behind:
using System.Collections.Generic;using System.Linq;using System.Windows;using System.Windows.Controls;using System.ComponentModel;namespace SL.ProgDropDown{ public partial class MainPage : UserControl, INotifyPropertyChanged { LookupCode[] codes; List<SampleData> items; public MainPage() { InitializeComponent(); DataContext = this; } private void Button_Click(object sender, RoutedEventArgs e) { items = (from c in Enumerable.Range(0, 10) select new SampleData { Code = "code1", Name = "Some name" + c }).ToList(); codes = new LookupCode[5]; codes[0] = new LookupCode { Code = "code1", Name = "aaaa" }; codes[1] = new LookupCode { Code = "code2", Name = "bbbb" }; codes[2] = new LookupCode { Code = "code3", Name = "ccccc" }; codes[3] = new LookupCode { Code = "code4", Name = "ddddd" }; codes[4] = new LookupCode { Code = "code5", Name = "eeeee" }; InvokePropertyChanged(new PropertyChangedEventArgs("LookupCodes")); InvokePropertyChanged(new PropertyChangedEventArgs("Items")); } public List<SampleData> Items { get { return items; } } public IEnumerable<LookupCode> LookupCodes { get { return codes; } } public event PropertyChangedEventHandler PropertyChanged; public void InvokePropertyChanged(PropertyChangedEventArgs e) { PropertyChangedEventHandler handler = PropertyChanged; if(handler != null) handler(this, e); } } public class LookupCode { public string Code { get; set; } public string Name { get; set; } } public class SampleData : INotifyPropertyChanged { private string code; private string name; public string Code { get { return code; } set { code = value; this.OnPropertyChanged("Code"); } } public string Name { get { return name; } set { name = value; this.OnPropertyChanged("Name"); } } public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged(string name) { if (this.PropertyChanged != null) { this.PropertyChanged(this, new PropertyChangedEventArgs(name)); } } }}This is SL4, using version Telerik 2010.2.924.1040 under IE 8, Windows 7 64bit.
Thanks,
Scott