Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting an error in searching data from dataGrid in wpf
    primarykey
    data
    text
    <p>I have tried to search in a <code>dataGrid</code> using the following XAML</p> <pre><code>&lt;DataGrid x:Name="grid" local:DataGridTextSearch.SearchValue="{Binding ElementName=SearchBox, Path=Text, UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding TestData}" &gt; &lt;DataGrid.Resources&gt; &lt;local:SearchValueConverter x:Key="SearchValueConverter" /&gt; &lt;Style TargetType="{x:Type DataGridRow}"&gt; &lt;Setter Property="local:DataGridTextSearch.IsTextMatch"&gt; &lt;Setter.Value&gt; &lt;MultiBinding Converter="{StaticResource SearchValueConverter}"&gt; &lt;Binding RelativeSource="{RelativeSource Self}" Path="DataContext.MyProperty" /&gt; &lt;Binding RelativeSource="{RelativeSource Self}" Path="(local:DataGridTextSearch.SearchValue)" /&gt; &lt;/MultiBinding&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;Style.Triggers&gt; &lt;Trigger Property="local:DataGridTextSearch.IsTextMatch" Value="True"&gt; &lt;Setter Property="IsSelected" Value="True" /&gt; &lt;/Trigger&gt; &lt;/Style.Triggers&gt; &lt;/Style&gt; &lt;/DataGrid.Resources&gt; &lt;/DataGrid&gt; </code></pre> <p>I got it from <a href="https://stackoverflow.com/questions/15467553/proper-datagrid-search-from-textbox-in-wpf-using-mvvm">here</a></p> <p>But it gives me an error that <code>DataGrid</code> is not defined. So I changed <code>&lt;DataGrid&gt;</code> to <code>&lt;my:DataGrid&gt;</code></p> <p>Now it gives me the following error on line no 1 : The attachable property SearchValue was not found in type DataGridTextSearch.</p> <p>And Another Error on Line no. 3 : The type local:SearchValueConverter was not found. Verify that you are not missing an assembly reference and that all reference assemblies have been built.</p> <p>The XAML of my window looks like :</p> <pre><code>&lt;Window x:Class="Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="532" xmlns:my="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit"&gt; &lt;Grid&gt; &lt;TextBox Height="29" Margin="104,22,147,0" Name="txt" VerticalAlignment="Top" AutoWordSelection="True" /&gt; &lt;my:DataGrid x:Name="grid" local:DataGridTextSearch.SearchValue="{Binding ElementName=SearchBox, Path=Text, UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding TestData}" &gt; &lt;my:DataGrid.Resources&gt; &lt;local:SearchValueConverter x:Key="SearchValueConverter" /&gt; &lt;Style TargetType="{x:Type DataGridRow}"&gt; &lt;Setter Property="local:DataGridTextSearch.IsTextMatch"&gt; &lt;Setter.Value&gt; &lt;MultiBinding Converter="{StaticResource SearchValueConverter}"&gt; &lt;Binding RelativeSource="{RelativeSource Self}" Path="DataContext.MyProperty" /&gt; &lt;Binding RelativeSource="{RelativeSource Self}" Path="(local:DataGridTextSearch.SearchValue)" /&gt; &lt;/MultiBinding&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;Style.Triggers&gt; &lt;Trigger Property="local:DataGridTextSearch.IsTextMatch" Value="True"&gt; &lt;Setter Property="IsSelected" Value="True" /&gt; &lt;/Trigger&gt; &lt;/Style.Triggers&gt; &lt;/Style&gt; &lt;/my:DataGrid.Resources&gt; &lt;/my:DataGrid&gt; &lt;/Grid&gt; &lt;/Window&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload