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
Developer technologies | .NET | .NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
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. Miscellaneous topics that do not fit into specific categories.
Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
Sign in to answer