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

GridViewComboBoxColumn could not work properly in RadWindow

1 Answer 100 Views
Window
This is a migrated thread and some comments may be shown as answers.
Ke
Top achievements
Rank 1
Ke asked on 18 Oct 2011, 04:34 AM
HI, I want to use GridViewComboBoxColumn in a radgridview. But I found if I use RadWindow to hold the radgridview, the combobox dropdown list could not show. However, it could work if I create my own window.
Please see my attachment code.
 public class Player
    {
        public string Name
        {
            get;
            set;
        }
 
        public Position Position
        {
        get;
        set;
        }
 
        public Player(string name, Position pos)
        {
            Name = name;
            Position = pos;
        }
    
    }
 public enum Position
    {
        [Description("China")]
        GB,
        [Description("Unite Kingdom")]
        UK,
        [Description("Unite States")]
        US
    }
public class ViewModel
    {
        private List<Player> allPlayers;
        public ObservableCollection<Player> AllPlayers
        {
            get
            {
                if (this.allPlayers == null)
                {
                    this.allPlayers = new List<Player>();
                    this.allPlayers.Add(new Player("Haibng"Position.GB));
                    this.allPlayers.Add(new Player("WHS"Position.UK));
                    this.allPlayers.Add(new Player("NY"Position.US));
 
                }
                return new ObservableCollection<Player>(this.allPlayers);
            }
        }
 
        public IEnumerable<Telerik.Windows.Data.EnumMemberViewModel> Positions
        {
            get
            {
                return Telerik.Windows.Data.EnumDataSource.FromType<Position>();
            }
        }
    }




<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
        >    
    <StackPanel>    
        <Button Content="Show Combo in RadWindow" Click="Button_Click" Width="180" Height="30" Margin="10,10,10,10"/>
        <Button Content="Show Combo in Comm Window" Click="Button2_Click" Width="180" Height="30" Margin="10,10,10,10"/>
        <telerik:RadGridView x:Name="radGridView" AutoGenerateColumns="False">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="Name"  DataMemberBinding="{Binding Name}" TextAlignment="Left" Width="160"/>
                <telerik:GridViewComboBoxColumn  Header="Position"  DataMemberBinding="{Binding Position}" Width="*" />
            </telerik:RadGridView.Columns> 
        </telerik:RadGridView>
    </StackPanel> 
</Window>
public partial class MainWindow : Window
    {
        
        public MainWindow()
        {
            InitializeComponent();
          
 
            ViewModel vm = new ViewModel();
            this.radGridView.ItemsSource = vm.AllPlayers;
 
            GridViewComboBoxColumn combo = (GridViewComboBoxColumn)this.radGridView.Columns[1];
            combo.ItemsSource = vm.Positions;
        }
 
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            RadWin u = new RadWin();
            u.Owner = this;
            u.ShowDialog();
        }        
 
        private void Button2_Click(object sender, RoutedEventArgs e)
        {
            MyWin w = new MyWin();
            w.Owner = this;
            w.ShowInTaskbar = false;
            w.ShowDialog();
        }
    }




<telerik:RadWindow x:Class="WpfApplication1.RadWin"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <telerik:RadGridView x:Name="radGridView" AutoGenerateColumns="False">
            <telerik:RadGridView.Columns>
                
                <telerik:GridViewDataColumn Header="Name"  DataMemberBinding="{Binding Name}" TextAlignment="Left" Width="160"/>
                <telerik:GridViewComboBoxColumn  Header="Position"  DataMemberBinding="{Binding Position}" Width="*" />
            </telerik:RadGridView.Columns>
 
        </telerik:RadGridView>
        <telerik:RadToolBar>
            <telerik:RadComboBox Name="graphModes" Width="250" Height="22" Margin="3">
                <ComboBoxItem>One</ComboBoxItem>
                <ComboBoxItem>Two</ComboBoxItem>
                <ComboBoxItem>Three</ComboBoxItem>
            </telerik:RadComboBox>
        </telerik:RadToolBar>
    </Grid>
</telerik:RadWindow>
 public partial class RadWin : RadWindow
    {
        public RadWin()
        {
            InitializeComponent();
            this.Width = 400;
            this.Height = 450;
            this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
 
            ViewModel vm = new ViewModel();
            this.radGridView.ItemsSource = vm.AllPlayers;
            
            GridViewComboBoxColumn combo = (GridViewComboBoxColumn)this.radGridView.Columns[1];
            combo.ItemsSource = vm.Positions;
        }
    }



<Window x:Class="WpfApplication1.MyWin"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"        
        Title="MyWin" Height="300" Width="300">
    <Grid>
        <telerik:RadGridView x:Name="radGridView" AutoGenerateColumns="False">
            <telerik:RadGridView.Columns>
 
                <telerik:GridViewDataColumn Header="Name"  DataMemberBinding="{Binding Name}" TextAlignment="Left" Width="160"/>
                <telerik:GridViewComboBoxColumn  Header="Position"  DataMemberBinding="{Binding Position}" Width="*" />
            </telerik:RadGridView.Columns>
 
        </telerik:RadGridView>
    </Grid>
</Window>
 public partial class MyWin : Window
    {
        public MyWin()
        {
            InitializeComponent();
            this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
 
            ViewModel vm = new ViewModel();
            this.radGridView.ItemsSource = vm.AllPlayers;
 
            GridViewComboBoxColumn combo = (GridViewComboBoxColumn)this.radGridView.Columns[1];
            combo.ItemsSource = vm.Positions;
        }
    }


<Application x:Class="WpfApplication1.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
         
    </Application.Resources>
</Application>
    public partial class App : Application
    {
    }

1 Answer, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 19 Oct 2011, 08:50 AM
Hello Ke,

We are aware of this problem and it should be fixed in the latest internal build. The fix also should be included in the upcoming beta version.

Best wishes,
Miroslav Nedyalkov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
Window
Asked by
Ke
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
Share this question
or