A text box that supports objects.
- Add the nuget package to your project from here: https://www.nuget.org/packages/IntellisenseTextBox/
- Add using statement to xaml file:
xmlns:controls="clr-namespace:SmartTextBox.Controls;assembly=SmartTextBox"
- Add control to your view:
<controls:IntellisenseTextBox/>
- ItemsSource: Bind to items to show in intellisense list
<controls:IntellisenseTextBox ItemsSource="{Binding IntellisenseItems}"/>
- EnableDetails: Allow user to double click on items in text box to show detail view (true/false)
<controls:IntellisenseTextBox EnableDetails="true"/>
- Segments: List of segments in the text box. A segment is either a TextSegment or a ObjectSegment. This represents the content of the text box.
<controls:IntellisenseTextBox Segments="{Binding Segments}"/>
- IntellisenseTrigger: String to match before showing intellisense popup. Defaults to "@".
<controls:IntellisenseTextBox IntellisenseTrigger="@"/>
- SearchText: The text entered after the IntellisenseTrigger, eg. if the user types "@asd" then the search text is "asd".
<controls:IntellisenseTextBox SearchText="{Binding SearchText}"/>
- ListItemTemplate: Overrides the data template for list items in intellisense popup.
<controls:IntellisenseTextBox>
<controls:IntellisenseTextBox.ListItemTemplate>
<DataTemplate>
<Border CornerRadius="2"
Margin="0,1,0,-3"
Padding="2,0,2,0"
Background="Transparent"
BorderBrush="Orange"
VerticalAlignment="Center"
BorderThickness="1">
<TextBlock Text="{Binding DisplayText}"></TextBlock>
</Border>
</DataTemplate>
</controls:IntellisenseTextBox.ListItemTemplate>
</controls:IntellisenseTextBox>
- GroupStyle: Overrides the group styles for list in intellisense popup.
<controls:IntellisenseTextBox>
<controls:IntellisenseTextBox.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate>
<TextBlock FontWeight="Bold" FontSize="14" Text="{Binding Name}"/>
</DataTemplate>
</GroupStyle.HeaderTemplate>
</GroupStyle>
</controls:IntellisenseTextBox.GroupStyle>
</controls:IntellisenseTextBox>
- ItemTemplate: Overrides the styles for each object in the text box.
<controls:IntellisenseTextBox>
<controls:IntellisenseTextBox.ItemTemplate>
<DataTemplate>
<Border CornerRadius="2"
Margin="0,1,0,-3"
Padding="2,0,2,0"
Background="Transparent"
BorderBrush="Orange"
VerticalAlignment="Center"
BorderThickness="1">
<TextBlock Text="{Binding DisplayText}"></TextBlock>
</Border>
</DataTemplate>
</controls:IntellisenseTextBox.ItemTemplate>
</controls:IntellisenseTextBox>
- ItemTemplate: Overrides the data template for the detail view
<controls:IntellisenseTextBox>
<controls:IntellisenseTextBox.DetailItemTemplate>
<controls:IntellisenseTextBox.DetailItemTemplate>
<DataTemplate>
<Grid Background="White">
<TextBlock Text="{Binding DisplayText}"></TextBlock>
</Grid>
</DataTemplate>
</controls:IntellisenseTextBox.DetailItemTemplate>
</controls:IntellisenseTextBox>