I started from the example in the demos.
Basically what is happening is that the template items render fine. Just when filtering is enabled everything disappears. Selecting the Item instead of typing causes the value to display the class type, not the TextSearch.TextPath.
What am I missing here?
<
DataTemplate
x:Key
=
"ComboBoxCustomTemplate"
>
<
Grid
Margin
=
"0 3"
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
/>
</
Grid.ColumnDefinitions
>
<
Grid.RowDefinitions
>
<
RowDefinition
/>
<
RowDefinition
/>
</
Grid.RowDefinitions
>
<
TextBlock
Grid.Row
=
"0"
>
<
Run
Text
=
"{Binding Distributor}"
></
Run
>
<
Run
>(</
Run
>
<
Run
Text
=
"{Binding Country}"
></
Run
>
<
Run
>)</
Run
>
</
TextBlock
>
<
TextBlock
Grid.Row
=
"1"
Foreground
=
"LightGray"
FontSize
=
"10"
Text
=
"{Binding Region}"
/>
</
Grid
>
</
DataTemplate
>
<
telerik:RadComboBox
x:Name
=
"DistributorTextBox"
Grid.Column
=
"1"
Grid.Row
=
"2"
ItemsSource
=
"{Binding DistributorData}"
VerticalAlignment
=
"Center"
EmptyText
=
"Select Distributor"
IsEditable
=
"True"
Cursor
=
"Hand"
telerik:StyleManager.Theme
=
"Windows7"
Height
=
"30"
IsFilteringEnabled
=
"True"
OpenDropDownOnFocus
=
"True"
TextSearchMode
=
"StartsWith"
TextSearch.TextPath
=
"Distributor"
ItemTemplate
=
"{StaticResource ComboBoxCustomTemplate}"
CanAutocompleteSelectItems
=
"False"
/>
I noticed that if I rip out the template, everything works as expected (filtering and selecting).
I am using the latest RadComboBox for Silverlight 4 and I am finding some memory leaks when I am binding it to my view model.
Here is my RadComboBox declaration:
<telerik:RadComboBox x:Name="rcbGender" ClearSelectionButtonVisibility="Visible" |
ItemsSource="{Binding GenderList, Mode=OneWay}" |
ClearSelectionButtonContent="Clear" SelectedValuePath="Key" DisplayMemberPath="Name" |
SelectedValue="{Binding Gender, Mode=TwoWay}"/> |
The GenderList is a property of the viewmodel:
public IEnumerable<KeyValueDataItem> GenderList |
{ |
get { return _genderList; } |
} |
public class KeyValueDataItem |
{ |
private string _key; |
private string _name; |
public KeyValueDataItem(string key, string name) |
{ |
_key = key; |
_name = name; |
} |
public string Name |
{ |
get |
{ |
return _name; |
} |
} |
public string Key |
{ |
get |
{ |
return _key; |
} |
} |
} |
Every time I open and close the page it stays in the memory and does not get clean up by GC. I spent a lot of time debugging it with WinDbg and narrowed it down to the RadComboBox causing this problem. When I removed the radcombobox and replaced it with Windows combobox that fixed the problem. I am using the radcombobox in my application a lot and wouldn't really want to replace it with other controls.
With the settings below, it always seems to auto complete for me. Say I have a value of 20 (list of strings) in my combo box. If I type '2' a zero is always put after no matter what I set the
CanAutocompleteSelectItems
to . It's also seems to work very differently on different computers sometimes showing the rest of the item selected, and sometimes not. I'm working on reproducing more issues. In one case some valid values are '1', '18' and if I type in a '1' and tab out it would give me 18 instead of 1. I haven't been able to reproduce this on my machine yet. It would also be nice if you just had an autocomplete box instead of having to guess on all the settings that change throughout different versions.
UPDATE: about '1', '18, if I change the order and but 18 before 1, that's when I get that error. Is there a way to do it without the order being like that?
<
telerik:RadComboBox
x:Name
=
"rc1"
OpenDropDownOnFocus
=
"False"
Margin
=
"5 0 0 0"
IsReadOnly
=
"False"
LostFocus
=
"rc1_LostFocus"
SelectionChanged
=
"rc1_SelectionChanged"
CanAutocompleteSelectItems
=
"False"
ClearSelectionButtonVisibility
=
"Visible"
ClearSelectionButtonContent
=
"Clear"
Width
=
"80"
IsEditable
=
"True"
>
</
telerik:RadComboBox
>
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; InfoPath.3; .NET4.0E)
Timestamp: Wed, 18 Aug 2010 20:13:40 UTC
Message: Unhandled Error in Silverlight Application
Code: 4004
Category: ManagedRuntimeError
Message: System.InvalidCastException: Unable to cast object of type 'Telerik.Windows.Controls.RadComboBoxAutomationPeer' to type 'System.Windows.Automation.Peers.SelectorAutomationPeer'.
at Telerik.Windows.Controls.ListBoxItem.OnCreateAutomationPeer()
at System.Windows.Automation.Peers.FrameworkElementAutomationPeer.CreatePeerForElement(UIElement element)
at System.Windows.Automation.Peers.ItemsControlAutomationPeer.CreatePeerForIndex(Object item, Int32 index)
at System.Windows.Automation.Peers.ItemsControlAutomationPeer.GetChildrenCore()
at Telerik.Windows.Controls.Automation.Peers.SelectorAutomationPeer.GetChildrenCore()
at Telerik.Windows.Controls.RadComboBoxAutomationPeer.GetChildrenCore()
at System.Windows.Automation.Peers.AutomationPeer.GetChildren()
at Telerik.Windows.Controls.Automation.Peers.SelectorAutomationPeer.RaiseSelectionEvents(SelectionChangedEventArgs e)
at Telerik.Windows.Controls.RadComboBox.OnSelectionChanged(SelectionChangedEventArgs e)
at Telerik.Windows.Controls.RadComboBox.SelectItemDelayedSelectionChanged(Object item)
at Telerik.Windows.Controls.RadComboBox.NotifyComboBoxItemMouseUp(RadComboBoxItem comboBoxItem)
at Telerik.Windows.Controls.RadComboBoxItem.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)
Line: 54
Char: 13
Code: 0