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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:53:11+00:00 2026-05-17T19:53:11+00:00

This question relates to this question . I have a EF model like this

  • 0

This question relates to this question.

I have a EF model like this.

Using Silverlight 4 I have an application showing questions to the user, defined through the QuestionSet. If a question has more than one answer alternative, a ComboBox is rendered. If only one alternative is given, a TextBox is rendered, in which the user can put freetext.

All user answers are stored in PersonQA entities. But herein lies the question: When the TextBox is rendered, I am not able to find the correct path and bind to the property “AnswerFreetext” (in PersonQA). What am I doing wrong?

XAML:

        <ListBox x:Name="QAListBox" ScrollViewer.VerticalScrollBarVisibility="Auto" SelectedIndex="-1" 
             ItemsSource="{Binding Questions}" IsTabStop="True" TabIndex="5" 
             ScrollViewer.HorizontalScrollBarVisibility="Auto" Margin="10" BorderThickness="0">
            <ListBox.Resources>
                <fx:EqualityToVisibilityConverter x:Key="converter"
                    TrueValue="Visible" FalseValue="Collapsed" />
                <fx:CollectionToFirstElementConverter x:Key="collectiontoitem" />
            </ListBox.Resources>
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid d:DesignWidth="931" d:DesignHeight="61" d:IsLocked="True" Margin="0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width=".80*" MinWidth="800"/>
                            <ColumnDefinition Width=".20*" MinWidth="200"/>
                        </Grid.ColumnDefinitions>
                        <TextBlock Text="{Binding Path=QuestionText}" Padding="10" FontSize="21.333" FontWeight="Bold" Margin="0" Grid.Column="0" d:IsLocked="True" />
                        <ComboBox ItemsSource="{Binding AnswerAlternative, Mode=OneWay}" 
                            SelectedValuePath="AnswerAlternativeId" DisplayMemberPath="AnswerText"
                            FontSize="21.333" FontWeight="Bold" Grid.Column="1" Margin="60,0,0,0" d:IsLocked="True" SelectionChanged="ComboBox_SelectionChanged"
                            Visibility="{Binding Path=AnswerAlternative.Count, Converter={StaticResource converter}, ConverterParameter=2}">
                        </ComboBox>
                        <TextBox Grid.Column="1" Margin="60,0,0,0" Text="{Binding Path=PersonQA.AnswerFreetext, Mode=TwoWay}"
                                 Visibility="{Binding AnswerAlternative.Count, Converter={StaticResource converter}, ConverterParameter=1}" />
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

The XAML has a ViewModel class as DataContext, which exposes Questions IEnumerable.

t.

  • 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-17T19:53:11+00:00Added an answer on May 17, 2026 at 7:53 pm

    I found an answer to my problem. It solves it by looking at the problem the opposite way. By iterating on the answers in stead of the questions, I am almost there.

    In addition I found that by using a ViewModelProxy-class (datacontext proxy) I am able to access the AnswerAlternative collection outside the relative binding inside the datatemplate. Read all about it here: http://weblogs.asp.net/dwahlin/archive/2009/08/20/creating-a-silverlight-datacontext-proxy-to-simplify-data-binding-in-nested-controls.aspx

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

Sidebar

Related Questions

Haven't seen many Geneva related questions yet, I have posted this question in the
Although somewhat related to this question , I have what I think is a
Much related to this question , we have a scenario on my team where
This is kind of related to my previous question, but not really. I have
This question relates to an ASP.NET website, originally developed in VS 2005 and now
Background: This question relates to versions of Delphi below 2009 (ie without Unicode support
I know this is not a real programming question. But, it relates to programming
This question is related to (but perhaps not quite the same as): Does Django
This question is related to another question which I asked yesterday! List all links
This question is related to a previous post of mine Here . Basically, I

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.