What's the simplest way to get the ComboBox of a GridViewComboBoxColumn cell to drop down as soon as it goes into edit mode?
Thanks,
Terry
7 Answers, 1 is accepted
You can achieve this by defining Editor style and setting IsDropDownOpen property to true. Please check the attached project as reference.
If you have any other issues or questions do not hesitate to contact us.
Sincerely yours,
Tsvyatko
the Telerik team
Thanks,
Terry
This issue could result of different factors. While I cannot give straight answer what is causing the issue I can give some directions what could be the cause:
- malformed XAML
- Running SL3 app and applying implicit styles
- Currupted Silverlight environment
I can also suggest you check this hyperlink for additional information:
http://forums.silverlight.net/forums/p/178858/435729.aspx
All the best,
Tsvyatko
the Telerik team
1. Automatically open on begin cell edit.
2. Automatically end cell edit on item select (or close drop down).
The first item does indeed work fine with an editor style as you prescribed. However, now it conflicts with how I was achieving the second item. I was doing it by adding an event handler to the grid view for the RadComboBox.SelectionChangedEvent and doing the following:
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (((RadComboBox)e.OriginalSource).IsDropDownOpen)
CurrentCell.CommitEdit();
}
And this was working fine until I implemented the first item. But I can see how this approach for the second item is probably not the best. However, I cannot discover another way to do it. Any suggestions?
Thanks,
Terry
Could please post the way you are subscribing to the event.
Greetings,
Tsvyatko
the Telerik team
My code for opening the combo box:
Style editorStyle = new Style(typeof(RadComboBox));
editorStyle.Setters.Add(
new Setter(RadComboBox.IsDropDownOpenProperty, true));
comboBoxColumn.EditorStyle = editorStyle;
My code for ending cell edit:
this.AddHandler(RadComboBox.SelectionChangedEvent, new SelectionChangedEventHandler ComboBox_SelectionChanged), true);
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (((RadComboBox)e.OriginalSource).IsDropDownOpen)
CurrentCell.CommitEdit();
}
The combination of these two causes the 'AccessViolationException'. Regardless of the exception, I don't think I can do it this way - the 'SelectionChanged' event is raised during the process of dropping down the combo box. Not good. Please help me figure out a way to get the two behaviors I want. Ideally, I'm thinking I just need an event I can hook into for when the drop down is closing (which I don't think currently exists) and use that instead of hooking into the SelectionChanged event.
Thanks,
Terry
Based on the latest request, I have modified the sample to enable the required functionality. The best way in this case is to inherit the GridViewCheckBoxColumn, extending the functionality that we need. Please have a look at the attachment and let know if this works for you.
Sincerely yours,
Tsvyatko
the Telerik team