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

  • SEARCH
  • Home
  • 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 8350595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:21:49+00:00 2026-06-09T08:21:49+00:00

The binding for productColumn2 works perfect both ways. When I added a converter for

  • 0

The binding for productColumn2 works perfect both ways. When I added a converter for each, productColumn1 called the converter; but always has it’s value set to null when loading from observable collection, or value set to product when assigning (but doesn’t actually assign observable collection).

Issue has to do with DataContext and LogicalTree. The DataContext for ProductSelectorTextBoxUserControl is itself, and is used for it’s own code. I want to be able to bind its ‘text’ property to my observable collection, as in productColumn2. I so far can’t seem to set ProductSelectorTextBoxUserControl DataContext to the DataContext used here.

<DataGrid ItemsSource="{Binding Path=ObservableCollectionItems, Mode=OneWay}" AutoGenerateColumns="False" EnableRowVirtualization="True" >
<DataGrid.Columns>
    <DataGridTemplateColumn x:Name="productColumn1" SortMemberPath="Product" >
        <DataGridTemplateColumn.CellTemplate>
            <DataTemplate>
                <productSelector:ProductSelectorTextBoxUserControl Text="{Binding Path=Product, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=LostFocus, ValidatesOnExceptions=True}" /> 
            </DataTemplate>
        </DataGridTemplateColumn.CellTemplate>
    </DataGridTemplateColumn>
    <DataGridTextColumn x:Name="productColumn2" Binding="{Binding Path=Product, Mode=TwoWay, NotifyOnSourceUpdated=True}" />            
</DataGrid.Columns>

  • 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-06-09T08:21:50+00:00Added an answer on June 9, 2026 at 8:21 am

    Thanks @SellMeADog for helping me out on this, however this still took me way way to long to figure out. Final line is:

    <productSelector:ProductSelectorTextBoxUserControl x:Name="productSelector" Product="{Binding Path=Item.Product, RelativeSource={RelativeSource FindAncestor, AncestorType=DataGridRow, AncestorLevel=1}, Converter={StaticResource productNameToProductConverter}, Mode=TwoWay, NotifyOnSourceUpdated=True, ValidatesOnExceptions=True}" />
    

    Key points are RelativeSource DataGridRow, Path is Item(ObservableCollection).Property

    If you notice question referred to text and this refers to product, I had to switch to product and add converter. UserControl would then set its own text

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

Sidebar

Related Questions

The Binding syntax, {Binding /} , works in WPF but does not work at
I binding ItemsSource of TabControl, when I added new TabItem, It is visible but
I am binding fields with name , value attributes. but it is not comfortable.
Two-way binding works excellent, but in case of TextBox it happens when control loses
When Binding a GridView to a DataTable, How can we Change the value displayed
Auto-binding of request params seems like default behaviour, but I can't find a lot
I am binding the value to report viewer dynamically. While click on the button
Binding model to the view. my model Person has {Id,Title,Address...etc) In my controller I
I'm binding the value of a Slider to an integer property that represents the
I know that binding to CLR properties is slower than INotifyPropertyChanged. But if my

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.