896 questions
How to binding ViewModel's SearchText variable to the DataGrid Cell as a converter parameter?

EdgeMac
20
Reputation points
I've an other question: How to binding ViewModel's SearchText variable to the DataGrid Cell as a converter parameter. I'm using a converter to change ViewModel's list's field name: "content" to highlightedText textBlock. but the Convert method can't get the ViewModel's SearchText variable. parameter is null here.
public object Convert(object value, Type targetType, object parameter, string language)
{
// parameter is null here.
var searchText = parameter
}
<localGrid:DataGridTemplateColumn Header="Content">
<localGrid:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ContentPresenter Content="{Binding Path=Content,
Converter={StaticResource HighlightTextConverter},
ConverterParameter={Binding ElementName=EditPage, Path=ViewModel.SearchText}}"/>
</DataTemplate>
<localGrid:DataGridTemplateColumn.CellTemplate>
<localGrid:DataGridTemplateColumn>
Windows development | Windows App SDK
Developer technologies | .NET | .NET MAUI
4,170 questions
Windows for business | Windows Client for IT Pros | User experience | Other
Developer technologies | .NET | Other
Developer technologies | .NET | Other
Microsoft Technologies based on the .NET software framework
4,107 questions
Developer technologies | C#
11,582 questions
Sign in to answer