Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 812889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:16:20+00:00 2026-05-15T01:16:20+00:00

Maybe the title was not quite exact since I am not sure about how

  • 0

Maybe the title was not quite exact since I am not sure about how to describe it.

I have a user control named NSLTextBlock, below is the definition of NSLTextBlock:

    public partial class NSLTextBlock: UserControl   
{
    public override void OnApplyTemplate()

   {
   base.OnApplyTemplate();
  }
  public object HighlightMatchCase
  {
   get { return GetValue(HighlightMatchCaseProperty); }
   set
   {
    SetValue(HighlightMatchCaseProperty, value);
   }
  }
  public static readonly DependencyProperty HighlightMatchCaseProperty =
   DependencyProperty.Register(
  "HighlightMatchCase",
  typeof(object),
  typeof(NSLTextBlock),
     new PropertyMetadata(null, new PropertyChangedCallback(HighlightChangedCallback)));

  public NSLTextBlock()
  {
   InitializeComponent();
  }
}
}

And the HighlightMatchCase is the Dependency Property.

The host view like this:

<ListView Name ="LogDataList" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding LogDataCollection}" Background="Cyan">
        <ListView.View>
            <GridView AllowsColumnReorder="true"
              ColumnHeaderToolTip="Event Log Information">
                <GridViewColumn Header="Event Log Name" Width="100">
                    <GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <l:NSLTextBlock Height="25" DataContext="{Binding LogName, Converter={StaticResource DataFieldConverter}}" HighlightMatchCase="{Binding Element}" Loaded="EditBox_Loaded"/>
                        </DataTemplate>
                    </GridViewColumn.CellTemplate>
                </GridViewColumn>
                <GridViewColumn Header="Creator" Width="100">
                    <GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <l:NSLTextBlock Height="25" DataContext="{Binding CreatorName, Converter={StaticResource DataFieldConverter}}" HighlightMatchCase="{Binding Element}" Loaded="EditBox_Loaded"/>
                        </DataTemplate>
                    </GridViewColumn.CellTemplate>
                </GridViewColumn>
                <GridViewColumn Header="Message" Width="100" >
                    <GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <l:NSLTextBlock Height="25" DataContext="{Binding Message, Converter={StaticResource DataFieldConverter}}"  HighlightMatchCase="{Binding Element}" Loaded="EditBox_Loaded"/>
                        </DataTemplate>
                    </GridViewColumn.CellTemplate>
                </GridViewColumn>
            </GridView>
        </ListView.View>
    </ListView>

DataField:

 public class DataField : INotifyPropertyChanged
    { 
    private HighlightElement  element;
    public HighlightElement Element
    {
      get
      { return element; }
      set
      {
         element = value;
         OnPropertyChanged("Element");
       }
      }
    }

Actually, I want to convert the string(such as LogName, CreatorName and Message) to DataField, and binding my self-defined property(HighlightMatchCase) to Element(the converted datacontext). When I bind it to Element, it throw BindingExpressionException, cannot find property ‘Element’ on the object.

How can I solve it? What is your suggestion?

I really appreciate. On line’in.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T01:16:21+00:00Added an answer on May 15, 2026 at 1:16 am

    The data context of a NSLTextBlock is not set to an instance of DataField for some reason. Add an eventhandler for OnDataContextChanged and with the debugger check what is going on. Maybe it is your DataFieldConverter that fails.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am not sure how to describe my question (maybe title is not proper).
Not a great title but I'm looking more for some guidance, have searched quite
SQL Server 2008: Sorry for the possibly non-informative title but I'm not sure quite
maybe the title is not very clear, let me elaborate. I have a python
Maybe my question title is not the right one but ill describe whats my
Maybe my title is not the best but here is what I really want.I
Maybe the title is not so descriptive. I'm working right with Galasoft MVVM framework,
I'm not too great with jquery and maybe this title doesn't explain too well
I am not quite sure I understand how to do the following. If I
enter code here Maybe the title is not so specific. The situation which I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.