Posted 11 Mar 2013 Link to this post
Posted 09 Jul 2013 Link to this post
Posted 10 Jul 2013 Link to this post
<
DataTemplate
x:Key
=
"autoCompleteDropDownTemplate"
>
ContentControl
ContentControl.Content
MultiBinding
Converter
"{StaticResource highlightConverter}"
Mode
"OneTime"
Binding
Path
"Label"
/>
"Category"
RelativeSource
"{RelativeSource Mode=FindAncestor, AncestorType=UserControl}"
"DataContext.CurrentSearchText"
</
public
object
Convert(
[] values, Type targetType,
parameter, System.Globalization.CultureInfo culture)
{
string
label = values[0]
as
;
category = values[1]
query = values[2]
if
(!
.IsNullOrEmpty(label) && !
.IsNullOrEmpty(category))
replacementstring =
.Format(
"%%{0}%%"
, query);
escapedXml = SecurityElement.Escape(label.Replace(query, replacementstring, StringComparison.InvariantCultureIgnoreCase));
withTags = escapedXml.Replace(replacementstring,
"<Run Style=\"{StaticResource highlightTextStyle}\">"
+ query +
"</Run>"
, StringComparison.InvariantCultureIgnoreCase);
wrappedInput = label.Equals(category, StringComparison.InvariantCultureIgnoreCase)?
"<TextBlock xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" Style=\"{StaticResource autocompleteCategoryStyle}\">"
+ category +
"</TextBlock>"
:
"<TextBlock xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" Style=\"{StaticResource autocompleteSuggestionTextStyle}\">"
+withTags+
using
(StringReader stringReader =
new
StringReader(wrappedInput))
(XmlReader xmlReader = XmlReader.Create(stringReader))
return
XamlReader.Load(xmlReader);
}
null
Style
TargetType
"telerik:RadListBoxItem"
Style.Triggers
DataTrigger
"{Binding Converter={StaticResource ac2fConverter}}"
Value
"False"
Setter
Property
"IsHitTestVisible"
Posted 11 Jul 2013 Link to this post
Items = new ListCollectionView(groupedItems.OrderBy(i => i.GroupName)); Items.GroupDescriptions.Add(new PropertyGroupDescription("GroupName"));
Items.GroupDescriptions.Add(new PropertyGroupDescription("GroupName"));
<telerik:RadComboBox.GroupStyle> <GroupStyle> <GroupStyle.HeaderTemplate> <DataTemplate> <Border BorderThickness = "0,0,0,1" BorderBrush="#CFCFCF" Margin="5, 2, 0, 15" > <TextBlock Text="{Binding Name}" Foreground="#B1A1A4" /> </Border> </DataTemplate> </GroupStyle.HeaderTemplate> </GroupStyle> </telerik:RadComboBox.GroupStyle>