<telerikGridView:GridViewComboBoxColumn |
x:Name="UserNamesComboBox" |
UniqueName="CollectedByIdDropDown" |
HeaderText="Collected By" |
DataMemberPath="CollectedById" |
DisplayMemberPath="Value" |
SelectedValueMemberPath="Key" |
IsReadOnly="False" /> |
and I populate it in codebehind:
private void InitializeUserDropdown() |
{ |
ComboBoxEditorSettings comboBoxEditorSettings = new ComboBoxEditorSettings(); |
try |
{ |
UserNameNvl.GetUserNameNvl((o, ex) => |
{ |
if (ex.Error != null) |
MessageBox.Show(ex.Error.ToString(), "Data error", MessageBoxButton.OK); |
else comboBoxEditorSettings.ItemsSource = ex.Object; |
}); |
} |
catch (Exception ex) |
{ |
MessageBox.Show(ex.ToString(), "Data error", MessageBoxButton.OK); |
} |
((GridViewDataColumn)this.DataEntryWizardTasksGridView.Columns["CollectedByIdDropDown"]).EditorSettings = comboBoxEditorSettings; |
} |
I'm using the same UserNameNvl object in my BO and it is working as expected with the key/value columns. However what I am seeing is that no data is displayed in my grid column. I can open the dropdown and I see my DisplayValues (full names) but when I select a value I'm not getting the key go back to the BO setter but the display value. This basically means I set the value but then it doesn't match to anything in the dropdown keys so it looks like nothing is there.
I'm not seeing any binding error messages to make me thing I've got a typo or something.
18 Answers, 1 is accepted
The ComboBox column has its own ItemsSource property. Instead of creating new ComboBoxEditor settings , please assign directly the itemssource of the column. It will automatically create the editor settings. When you create your own editor settings they will override the settings from XAML and I believe this is the cause of the problem.
So your code should look something like :
((GridViewComboBoxColumn)this.DataEntryWizardTasksGridView.Columns["CollectedByIdDropDown"]).ItemsSource = ex.Object; |
Instead of assigning new Combobox editor settings.
Let me know if you need further assistance on this issue.
Greetings,
Pavel Pavlov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Why is it that I can't speficy the itemsource property via XAML? I get AG_PARSER errors as soon as I include anything related to ItemSource.
I have made some tests here. There should not be any problem with setting ItemsSource in XAML .
If it is still an issue , you can send me the XAML and the codebehind ( ideally a project) I can check it and tell you what is the reason for he exception.
Regards,
Pavel Pavlov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
I have made some tests here. There should not be any problem with setting ItemsSource in XAML .
If it is still an issue , you can send me the XAML and the codebehind ( ideally a project) I can check it and tell you what is the reason for the exception.
Regards,
Pavel Pavlov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
To have the ComboBox column ready for action you need to set the following properties:
1. ItemsSource /fills the combo with items/
2. DisplayMemerPath /tells the combo which property of the item to display/
3. SelectedValueMemberPath / tells the combo which property to store after selection/
4. DataMemberBinding /tells the column which property from the RadGridView.ItemsSource to use/
If you wonder how to set these, please have a look here.
In case you still have troubles I will be glad too have a look at your source and make the necessary adjustments.
*Also please note that the ComboBox will appear only when the cell is in edit mode e.g. the user clicks within a cell to start editing. When not in edit mode the cell will display just a textblock with the selected value.
All the best,
Pavel Pavlov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
*Also please note that the ComboBox will appear only when the cell is in edit mode e.g. the user clicks within a cell to start editing. When not in edit mode the cell will display just a textblock with the selected value.
So the combobox will display the selected value when not in edit mode. I would have hoped that it would have displayed the DisplayMember. In our case the selected value is an ID and we want the text to be the Displaymember text.
There seems to be a misunderstanding . Indeed as you expect , when in display mode, the cell will still respect the DisplayMemberPath and will show the display member rather than the ID. In case you have troubles setting up the properties , just let me know the details of your scenario and I may send a small sample.
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.
I am having another issue, where the combobox doesnt update when the data is changed in the VM code and not via the GUI. I have an example where it works correctly, but it just doesnt in my real code. Still trying to track down the issue. The bound field is raising PropertyChanged event, so I am not sure what is going on. Still rearching it.
Do you bind to a nested property ?
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.
Code is below.
GridViewColumns.Add(
new GridViewComboBoxColumn()
{
Header = alg,
DataMemberBinding = new Binding(string.Format("StateOptions[{0}].Value", colNbr))
{
Mode =
BindingMode.TwoWay
},
SelectedValueMemberPath =
"OrgValue",
DisplayMemberPath =
"ValueDescription",
ItemsSource = multiChoiceColumnData,
}
);
Did you have a suggestion to help me fix my issue?
Thanks
Kevin
Yes , tomorrow( or Monday) there will be an internal build that will include a fix for a known issue with RadGridView not respecting property change notifications when combo column is bound to a nested property.
So my suggestion would be to to wait a day or tow and then upgrade with the fresh dlls from the Friday internal build .
Please excuse us for the inconvenience caused.
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.
Thanks for the update. I am glad you pointed out the issue, I was starting to get frustrated, thinking what didnt I hook up.
Thanks
Kevin Happe
Thomson Reuters
However it broke the binding update for a column bound to a boolean value.
Is there a fix planned for that?
Indeed there were some changes in the logic for binding to boolean values.
Can you please describe with some more details(XAML and/or code) your scenario and what exactly is broken.
I will try to provide a fix till the end of the week if possible.
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.
I am having an issue with a checkbox column not responding to a change notification when the column is bound to a nested property. I had the same issue with the combobox column. The weekly build fixed the combobox column change notification, but broke the cneckbox column change notification.
GridViewColumns.Add(
new GridViewDataColumn()
{
Header = alg,
DataMemberBinding =
new Binding(string.Format("StateOptions[{0}].BooleanValue", colNbr))
{
Mode =
BindingMode.TwoWay
},
IsReadOnly =
false,
MaxWidth = 100,
DataType =
Type.GetType("System.Boolean")
});