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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:58:44+00:00 2026-05-30T07:58:44+00:00

Have a ViewModel with two properties: Venue and States Venue is the current view

  • 0

Have a ViewModel with two properties: Venue and States
Venue is the current view that is selected and being displayed via a form (below):

<StackPanel Orientation="Vertical" Margin="20,00,0,0" FlowDirection="LeftToRight" DataContext="{Binding Venue}">
            <TextBlock Text="Venue Name" Style="{StaticResource FormHeading}" />
            <TextBox x:Name="txtVenueName" Width="200" MaxLength="70" HorizontalAlignment="Left" Text="{Binding VenueName, Mode=TwoWay}" />

            <TextBlock Text="Address" Style="{StaticResource FormHeading}" />
            <TextBox x:Name="txtAddress" Width="300" MaxLength="100" HorizontalAlignment="Left" Text="{Binding Address, Mode=TwoWay}" />

            <TextBlock Text="City" Style="{StaticResource FormHeading}" />
            <TextBox x:Name="txtCity" Width="200" MaxLength="100" HorizontalAlignment="Left" Text="{Binding City, Mode=TwoWay}" />

            <TextBlock Text="State" Style="{StaticResource FormHeading}" />
            <ComboBox Width="70" HorizontalAlignment="Left" Name="cmbState" DisplayMemberPath="FullName"
                      ItemsSource="{Binding Path=States, ElementName=LayoutRoot}"/>

            <TextBlock Text="Zipcode" Style="{StaticResource FormHeading}" />
            <TextBox x:Name="txtZipCode" Width="50" MaxLength="5" HorizontalAlignment="Left" Text="{Binding Zipcode, Mode=TwoWay}" />

            <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
                <TextBlock Text="Active?" Style="{StaticResource FormHeading}" Margin="0,0,10,0"  />
                <CheckBox Name="chkActive" />
            </StackPanel>
        </StackPanel>

States is not a member of Venue, however, but it is a property at the same level as Venue. How can I bind to this property? Looked at RelativeSource, doesnt seem to be quite what I am looking for.

Thanks

  • 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-30T07:58:46+00:00Added an answer on May 30, 2026 at 7:58 am

    Currently you’re setting DataContext={Binding Venue}. One option is to remove this and then alter the other bindings to be Text="{Binding Venue.VenueName, ...}" etc. You could then use ItemsSource="{Binding Path=States, ..."}.

    Alternatively a RelativeSource binding would work. Something like:

    ItemsSource="{Binding Path=States, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}"
    

    depending on the type of the parent of the StackPanel obviously.

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

Sidebar

Related Questions

I have a ViewModel that encapsulates some properties that are being edited in an
I have a View that is linked to my ViewModel using a DataTemplate, like
I have MyCollection of MyPOCO object (that has two string properties). When I try
Form contains two dropdown lists created using code below. Both dropdown list elements have
I have an insurance entry form that has contact information for two people. I
I have the properties for two entities in a ViewModel. The two entities are
I have two C# classes that have many of the same properties (by name
I have two classes (MVC view model) which inherits from one abstract base class.
I have a ViewModel I am binding to a view: ProductViewModel model = Mapper.Map<Product,
I have a ViewModel class that contains a list of points, and I am

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.