This question is locked. New answers and comments are not allowed.
Hello,
I alread looked up nearly a hundred threads about this theme but I still have problems achieving a more or less simple task. I would be very happy in case someone could help me out:
I would like to display several columns in a RadGridView. If the user clicked on the first column, it should turn into a (autofill) RadComboBox.
I dynamically (gvCars.ItemsSource=xx) bound the RadGridView to an ObserveableCollection of my type, let's say ObserveableCollection<Cars> and it displays the following entries:
Brand | Year | Price
VW 2010 27.102 €
BMW 2011 57.102 €
This works fine.
However, when I click on the "Brand" column, I would like it to switch to the RadComboBox control so that the user can select one of the values which are in my ObserveableCollection<string>theBrands variable, which is just a list of strings like "VW","BMW","Porsche" etc.
What happens in my app is that the column "Brand" turns into the RadComboBox (yippie!) but I cannot select anything from the RadComboBox (it does not even drops) as if the 'theBrands' collection was empty (but it is not).
Second problem: If the user had the opportunity to select some other brand from the RadComboBox, I would like this brand to be stored back in the ObserveableCollection<Cars> again (eg in the "Brand" property of the "Cars" class) or somewhere else where I can exchange the previous value with the newly selected value.
So I have two ObservableCollections, one for the "real" data (displayed in the grid) and one especially only for the RadComboBox selection choices.
My XAML currently looks like this:
Can you help me out please?
Thank you,
Lars.
I alread looked up nearly a hundred threads about this theme but I still have problems achieving a more or less simple task. I would be very happy in case someone could help me out:
I would like to display several columns in a RadGridView. If the user clicked on the first column, it should turn into a (autofill) RadComboBox.
I dynamically (gvCars.ItemsSource=xx) bound the RadGridView to an ObserveableCollection of my type, let's say ObserveableCollection<Cars> and it displays the following entries:
Brand | Year | Price
VW 2010 27.102 €
BMW 2011 57.102 €
This works fine.
However, when I click on the "Brand" column, I would like it to switch to the RadComboBox control so that the user can select one of the values which are in my ObserveableCollection<string>theBrands variable, which is just a list of strings like "VW","BMW","Porsche" etc.
public ObservableCollection<string> theBrands { get; set; }
// ... within the source code I do the following:
theBrands.Add("VW");
theBrands.Add("BMW");
theBrands.Add("Porsche...");
// I even tried adding the fields before calling InitializeComponents(), no effekt.
What happens in my app is that the column "Brand" turns into the RadComboBox (yippie!) but I cannot select anything from the RadComboBox (it does not even drops) as if the 'theBrands' collection was empty (but it is not).
Second problem: If the user had the opportunity to select some other brand from the RadComboBox, I would like this brand to be stored back in the ObserveableCollection<Cars> again (eg in the "Brand" property of the "Cars" class) or somewhere else where I can exchange the previous value with the newly selected value.
So I have two ObservableCollections, one for the "real" data (displayed in the grid) and one especially only for the RadComboBox selection choices.
My XAML currently looks like this:
<telerik:RadGridView telerik:StyleManager.Theme="Vista" RowValidating="GridView_RowValidating" CellValidating="GridView_CellValidating" BeginningEdit="GridView_BeginningEdit"
RowEditEnded="GridView_RowEditEnded" AddingNewDataItem="GridView_AddingNewDataItem" Margin="120,25,32,31" Name="gvCars" Grid.Row="2" TabIndex="6" AutoGenerateColumns="False"
SelectionMode="Multiple" ShowGroupFooters="False" ShowInsertRow="True" ActionOnLostFocus="CancelEdit" CanUserSelect="True"> <telerik:RadGridView.Columns> <telerik:GridViewDataColumn DataMemberBinding="{Binding Brand, Mode=TwoWay}" Header="Brand"> <telerik:GridViewDataColumn.CellEditTemplate> <DataTemplate> <telerik:RadComboBox Name="cbBrand" IsEditable="True" CanAutocompleteSelectItems="true" ItemsSource="{Binding theBrands, Mode=TwoWay}"/> </DataTemplate> </telerik:GridViewDataColumn.CellEditTemplate> </telerik:GridViewDataColumn> <telerik:GridViewDataColumn DataMemberBinding="{Binding Year, Mode=TwoWay}" Header="Year" IsReadOnly="True"/> <telerik:GridViewDataColumn DataMemberBinding="{Binding Price, Mode=TwoWay}" Header="Price"/> </telerik:RadGridView.Columns> </telerik:RadGridView>Can you help me out please?
Thank you,
Lars.