Requirements |
|
RadControls version |
|
.NET version |
|
Visual Studio version |
|
programming language |
|
browser support |
all browsers supported by RadControls |
Dear Telerik team,
I'am running my own company and recently started with developing silverlight applications.
At this moment I have difficulties with the GridViewComboBoxColumn.
In the debugger I can see that data is loaded into the combo but when clicking the related column no combo will be displayed.
I saw other people having similar problems on google but did not find a solution yet.
I hope you can help me out.
Many thx's
My code is as follows :
Class holding data for the combo
using System; using System.Collections.Generic; namespace gridview { public class Amount { private double _AmountValue; private long _AmountID; public long AmountID { get { return _AmountID; } set { _AmountID = value; } } public double AmountValue { get { return _AmountValue; } set { _AmountValue = value; } } } }
The xaml file
<Grid x:Name="demoGridview" Background="White" Height="300" Width="1000"> <telerik:RadGridView x:Name="RadGridView1" Margin="26,0,-60,-86" RowIndicatorVisibility="Collapsed" IsReadOnly="True" MinHeight="386" MaxHeight="500" AutoGenerateColumns="False" CanUserFreezeColumns="False" CanUserResizeColumns="False" AlternateRowBackground="Azure" CanUserDeleteRows="False" CanUserInsertRows="False" DataLoaded="RadGridView1_DataLoaded"> <telerik:RadGridView.Columns> <telerik:GridViewToggleRowDetailsColumn /> <telerik:GridViewComboBoxColumn Header="Aantal" Width="50" DataMemberBinding="{Binding AmountID}" SelectedValueMemberPath="AmountID" DisplayMemberPath="AmountValue" UniqueName="AmountValues"/> <telerik:GridViewComboBoxColumn Header="Leverancier" Width="200" DataMemberBinding="{Binding SupplierID}" SelectedValueMemberPath="SupplierID" DisplayMemberPath="SupplierValue" UniqueName="SupplierValues"/> <telerik:GridViewComboBoxColumn Header="OrderType" Width="100" DataMemberBinding="{Binding OrderTypeID}" SelectedValueMemberPath="OrderTypeID" DisplayMemberPath="OrderTypeValue" UniqueName="OrderTypeValues"/> </telerik:RadGridView.Columns> <!-- specify the objects when the row is expanded by the customer --> <telerik:RadGridView.RowDetailsTemplate> <DataTemplate> <StackPanel Height="60" HorizontalAlignment="Left" Name="StackUserInput" VerticalAlignment="Top"> <Grid x:Name="grdUserInput" Background="White" Width="1000" Height="60" ShowGridLines="False"> <Grid.RowDefinitions> <RowDefinition Height="5"></RowDefinition> <!-- dummy to create an offset from the top--> <RowDefinition Height="25"></RowDefinition> <RowDefinition Height="25"></RowDefinition> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="100"></ColumnDefinition> <!-- dummy to create an offset from the left--> <ColumnDefinition Width="150"></ColumnDefinition> <ColumnDefinition Width="200"></ColumnDefinition> </Grid.ColumnDefinitions> <sdk:Label Height="22" HorizontalAlignment="Left" Name="lblInternalRemark" Content="Opmerking intern" VerticalAlignment="Top" Width="127" Grid.Row="1" Grid.Column="1"/> <TextBox Height="22" HorizontalAlignment="Left" Name="txtInternalRemark" VerticalAlignment="Top" Width="150" Grid.Row="1" Grid.Column="2"/> <sdk:Label Height="22" HorizontalAlignment="Left" Name="lblExternalRemark" Content="Opmerking extern" VerticalAlignment="Top" Width="127" Grid.Row="2" Grid.Column="1" /> <TextBox Height="22" HorizontalAlignment="Left" Name="txtExternalRemark" VerticalAlignment="Top" Width="150" Grid.Row="2" Grid.Column="2"/> </Grid> </StackPanel> </DataTemplate> </telerik:RadGridView.RowDetailsTemplate> </telerik:RadGridView> </Grid>
The related cs file
private void RadGridView1_DataLoaded(object sender, EventArgs e) { FillAmountvalues(); }private void FillAmountvalues() { List<Amount> AmountList = new List<Amount> { new Amount { AmountID=1,AmountValue=1 }, new Amount { AmountID=2,AmountValue=2 }, new Amount { AmountID=3,AmountValue=3 }, new Amount { AmountID=4,AmountValue=4 }, new Amount { AmountID=5,AmountValue=5 } }; try { GridViewComboBoxColumn comboBoxColumnAmount = (RadGridView1.Columns["AmountValues"] as GridViewComboBoxColumn); if (comboBoxColumnAmount != null) { comboBoxColumnAmount.ItemsSource = AmountList; } } catch (NullReferenceException err) { Console.WriteLine("an error has occured namely '" + err.Message + "'"); } finally { Console.WriteLine("amounts added to the combo"); } #endregion }