How can we improve the WPF and Silverlight documentation?

The example given for Full Text Grid Filtering for the C1DataGrid does not work

When attempting to run it as given, I get this binding error in the Output window in Visual Studio:

System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=C1Text; DataItem=null; target element is 'C1FullTextSearchBehavior' (HashCode=41883657); target property is 'Filter' (type 'String')

Because of this, the binding can't update. Since the binding can't update, filtering never occurs.

4 votes
Vote
Sign in
(thinking…)
Password icon
Signed in as (Sign out)
You have left! (?) (thinking…)
Matthew Korth shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

1 comment

Sign in
(thinking…)
Password icon
Signed in as (Sign out)
Submitting...
  • C1_Antihero commented  ·   ·  Flag as inappropriate

    Hello Matthew,

    C1FullTextSearchBehavior.Filter is set in TextChanged event in our product sample. I assume you changed our sample and set C1FullTextSearchBehavior.Filter in xaml page as the following:

    <c1:C1FullTextSearchBehavior.FullTextSearchBehavior>
    <c1:C1FullTextSearchBehavior Filter="{Binding ElementName=filter, Path=C1Text}"/>
    </c1:C1FullTextSearchBehavior.FullTextSearchBehavior>

    I could observe the problem. I think this is because C1FullTextSearchBehavior is not in visual tree. I suggest you could change it as the following instead.

    <c1:C1FullTextSearchBehavior.FullTextSearchBehavior>
    <!--<c1:C1FullTextSearchBehavior Filter="{Binding ElementName=filter, Path=C1Text}"/>-->
    <c1:C1FullTextSearchBehavior Filter="{Binding Source={x:Reference filter}, Path=C1Text}"/>
    </c1:C1FullTextSearchBehavior.FullTextSearchBehavior>

    Please refer to http://stackoverflow.com/questions/9122592/elementname-binding-is-failing. I hope this could solve you problem.

    Thanks,
    Henry

Feedback and Knowledge Base