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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:46:05+00:00 2026-06-01T12:46:05+00:00

I want to bind one data to several controls. Is there some logical control

  • 0

I want to bind one data to several controls. Is there some logical control in WPF to achieve this?
For example i have a Grid

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition />
        <ColumnDefinition />
    </Grid.ColumnDefinitions>

    <TextBlock Text="{Binding Name}" />
    <Button Grid.Column="1" Grid.RowSpan="2" IsEnabled="{Binding IsSimulationRunning}" />
    <controls:PlayerControl Grid.Row="1" IsEnabled="{Binding IsLoaded}" />
</Grid>

and I want to bind TextBlock to one data and Button and PlayerControl to another, like this:

<Container DataContext="{Binding Object2}">
    <Button IsEnabled="{Binding IsSimulationRunning}" />
    <controls:PlayerControl IsEnabled="{Binding IsLoaded}" />
</Container>

How can I do this in the best way?

  • 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-01T12:46:06+00:00Added an answer on June 1, 2026 at 12:46 pm

    The binding binds to the DataContext of the element containing the dependency property. And you can bind the DataContext to the underlying view model:

    <TextBlock DataContext="{Binding Object1}" Text="{Binding Name}" />
    <Button Grid.Column="1" Grid.RowSpan="2" 
        DataContext="{Binding Object2}" IsEnabled="{Binding IsSimulationRunning}" />
    <controls:PlayerControl Grid.Row="1" 
        DataContext="{Binding Object2}" IsEnabled="{Binding IsLoaded}" />
    

    If your view model looks like this:

    public class PlayerViewModel {        
        public TrackViewModel Object1 { get; set; }
        public PlaybackViewModel Object2 { get; set; }
    }
    public class TrackViewModel { public string Name { get; set; } }
    public class PlaybackViewModel { 
        public bool IsLoaded { get; set; } 
        public bool IsSimulationRunning { get; set; }
    }
    

    In this case you could bind to the objects directly. The main point is that you need to have the two objects in 1 common view model.

    <TextBlock Text="{Binding Path=Object1.Name}" />
    <Button Grid.Column="1" Grid.RowSpan="2" IsEnabled="{Binding Path=Object2.IsSimulationRunning}" />
    <controls:PlayerControl Grid.Row="1" IsEnabled="{Binding Path=Object2.IsLoaded}" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one Listbox and a List of data I want to bind the
I have one view page (MyView.aspx) and many data sources to bind on this
I want to bind one property to multiple sources. My reason for this are
I have created a data grid in WPF and have 2 lists. I want
I have an ObservableCollection<Object> that contains two different types. I want to bind this
i have one hidden field and i want to bind it with two values
I have an existing XAML file with some data templates in it. One of
I want to bind my ListView control to a generic list of objects? I
i wan to disable drag event using jquery and want to bind one another
I try to built a DataGrid, and I want to bind one of the

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.