Hi Telerik support,
My purpose is that I need my ComboBox that can display both value and description (highlight), so I created my custom item template.
But, when I set the ComboBox IsEnabled to false, the ComboBox just dispeared, Did I go anything wrong or miss anything?
code snippets:
Thanks!
My purpose is that I need my ComboBox that can display both value and description (highlight), so I created my custom item template.
But, when I set the ComboBox IsEnabled to false, the ComboBox just dispeared, Did I go anything wrong or miss anything?
code snippets:
public
class
MyRadComboBox : RadComboBox
{
public
MyRadComboBox()
{
DataTemplate selData = (DataTemplate)XamlReader.Load(
@"<DataTemplate
xmlns=
""
http:
//schemas.microsoft.com/client/2007"">
<TextBlock Text=
""
{Binding Value}
""
/>
</DataTemplate>"
);
DataTemplate itemTmp = (DataTemplate)XamlReader.Load(
@"<DataTemplate
xmlns=
""
http:
//schemas.microsoft.com/client/2007"">
<StackPanel Orientation=
""
Horizontal
""
>
<TextBlock Text=
""
{Binding Value}
""
/>
<TextBlock Text=
""
""
/>
<TextBlock Text=
""
{Binding Description}
""
Foreground=
""
Blue
""
/>
</StackPanel>
</DataTemplate>");
ItemsPanelTemplate itemsPanelTmp = (ItemsPanelTemplate)XamlReader.Load(
@"<ItemsPanelTemplate
xmlns=
""
http:
//schemas.microsoft.com/client/2007"">
<VirtualizingStackPanel />
</ItemsPanelTemplate>");
base
.SelectionBoxTemplate = selData;
base
.ItemTemplate = itemTmp;
base
.ItemsPanel = itemsPanelTmp;
base
.SelectedValuePath =
"Value"
;
Telerik.Windows.Controls.TextSearch.SetTextPath(
this
,
"Value"
);
}
}
public
class
MyComboBoxItem
{
public
string
Value {
get
;
set
; }
public
string
Description {
get
;
set
; }
public
object
DataContext {
get
;
set
; }
}
public
class
MyComboBoxItemCollection : ObservableCollection<MyComboBoxItem>
{
public
MyComboBoxItemCollection()
:
base
()
{
}
}
Thanks!