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 8354701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:37:58+00:00 2026-06-09T09:37:58+00:00

I am trying to bind a dependency property to a collection’s current selection and

  • 0

I am trying to bind a dependency property to a collection’s current selection and for reasons I can’t seem to grasp, the binding does not update when the collection changes.

In the example below, I show two example. One is updating correctly (on the textblock/run), and the other only displays the initial element and doesn’t change when the data grid selection changes.

<Grid>
    <Grid.Resources>
        <CollectionViewSource Source="{Binding Path=List}" x:Key="myViewModel"/>
        <my:UpdateNotWorking MyObjModel="{Binding Source={StaticResource myViewModel}, Path=CurrentItem}" x:Key="updateNotWorking" />
    </Grid.Resources>

    <DataGrid ItemsSource="{Binding Source={StaticResource myViewModel}}" Name="mylistbox"/>
    <TextBlock TextWrapping="Wrap" FontWeight="Bold" Foreground="#FF50CEFF" FontSize="24" TextAlignment="Center" Height="75">
            <Run Text="{Binding Source={StaticResource myViewModel}, Path=text}" Foreground="#FF00E200" />
    </TextBlock>
    <TextBox Text="{Binding Source={StaticResource updateNotWorking}, Path=MyObjModel.text}" Height="22"/>

</Grid>

My dependency property in this example is “MyObjModel” on the “UpdateNotWorking” dependency object which is instantiated from the xaml code.

I would appreciate any information as to why my property is not updating correctly.

Example Project

  • 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-09T09:38:00+00:00Added an answer on June 9, 2026 at 9:38 am

    Paste this XAML into your MainWindow.

      <Grid>
        <Grid.Resources>
          <CollectionViewSource Source="{Binding Path=List}" x:Key="myViewModel" />
          <my:UpdateNotWorking x:Key="updateNotWorking" />
        </Grid.Resources>
    
        <DataGrid ItemsSource="{Binding Source={StaticResource myViewModel}}" Name="mylistbox"
                  SelectedItem="{Binding Source={StaticResource updateNotWorking}, Path=MyObjModel, UpdateSourceTrigger=PropertyChanged}" />
        <TextBlock TextWrapping="Wrap" FontWeight="Bold" Foreground="#FF50CEFF" FontSize="24" TextAlignment="Center"
                   Height="75">
          <Run Text="{Binding Source={StaticResource myViewModel}, Path=text}" Foreground="#FF00E200" />
        </TextBlock>
        <TextBox Text="{Binding Source={StaticResource updateNotWorking}, Path=MyObjModel.text, UpdateSourceTrigger=PropertyChanged}"
                 Height="22" />
    
      </Grid>
    

    What it is now doing is setting updateNotWorking‘s MyObjModel property based on the DataGrid’s SelectedValue, with UpdatePropertyTrigger set to PropertyChanged to see the changes immediately. No longer do we need to define updateNotWorking‘s property through the List’s CurrentItem because it is not going to change just by selecting it with a DataGrid. You can keep it set, but it is not required as we are doing all the manual labor with the DataGrid SelectedValue.

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

Sidebar

Related Questions

I'm trying to bind a Dependency Property from my UserControl to my MainViewModel. This
I am trying to bind to a static class and can't seem to get
I am trying to bind to an integer property: <RadioButton Content=None IsChecked={Binding MyProperty, Converter={StaticResource
I'm trying to bind the Forderground dependency property to my UIControl, so that it's
I am trying to bind a dependency property via XAML to my custom WPF
I am trying to bind a text box to a dependency property to change
I'm trying to bind a list of data to a data grid, but can't
I am trying to bind a property (Button.Background) to a property on my custom
I am trying to bind the value of a property (MyTitle) of a class
I am trying to bind to a property while inside a XAML 'property setter'.

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.