Hi I want to highlight part of a text that is in a texblock and that textblock is in a datatemplate of a listbox. I'm trying to do this as the user is searching through a list from entering text in a textBOX. (It is something similar to when searching in Windows File explorer) The textblock is bound to a property of a custom class.
Here is the XAML of the listbox DataTemplate
<ListBox Grid.Row="1" HorizontalContentAlignment="Stretch" Name="
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Name="me" Height="25" Margin="0,2">
<DockPanel>
<TextBlock DockPanel.Dock="Left" FontSize="15" TextAlignment="Center" Text="{Binding ProductID}"></TextBlock>
<Image HorizontalAlignment="Right" MouseUp="listboxStockPickItems_AddClick" DockPanel.Dock="Right" VerticalAlignment="Stretch" Margin="0,0,5,0" Cursor="Hand" Width="20" Height="20" Source="/Images/addItem.png"></Image>
</DockPanel>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Here is the custom class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace UCServer
{
[Serializable]
public class Articulo
{
public int ID { get; set; }
public string ProductID { get; set; }
public string Name { get; set; }
public int Amount { get; set; }
public double Price { get; set; }
}
}
Any help will be greatly appreciated!