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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:02:18+00:00 2026-06-01T19:02:18+00:00

I’m working in a survey form. The survey is created from an object with

  • 0

I’m working in a survey form. The survey is created from an object with the following structure:

Survey –has–> Sections –has–> Questions –has–> QuestionOptions

Each QuestionOption has:
QuestionID (relate to the Question)
OptionText (What will be displayed in ComboBox (DisplayMemeber binding))
OptionValue (The score of the option, usually 1-5 (SelectedValuePath binding))

Results for a Survey are stored in the folowwing structure:

Result –has–> Answers

Each Answer has:
QuestionID (to link answer to survey option in database)
Score (This comes from the value selecter by user in the ComboBox)

Saving works fine, but if I need to Edit a Survey, I need to bring back the results chosen so far. The object “Result” is populated perfectly, so I have all the data available.

The Problem is in GUI:
How should I initialize or set each ComboBox created from DataTemplate with the corresponding value of the stored survey? Take in consideration the ComboBox is generated from object “Survey” and the answers are in object “Result”

The XAML code used for ComboBox is:

<DataTemplate x:Key="QuestonTemplate">
            <StackPanel Margin="10,2,10,2" Orientation="Vertical">
                <TextBlock HorizontalAlignment="Left" Text="{Binding Path=QuestionText}" TextWrapping="Wrap" Height="Auto" Margin="5" FontSize="14" />
                <ComboBox x:Name="Options" Grid.Row="1" HorizontalAlignment="Left" Width="400"  Margin="10,0,10,0" 
                    Style="{StaticResource FlatComboBoxPaleYellow}"                              
                    ItemsSource="{Binding Path=QuestionOptions}" 
                    SelectedValuePath="OptionValue" 
                    DisplayMemberPath="OptionText"                         
                    SelectionChanged="Answer_SelectionChanged" />
            </StackPanel>
        </DataTemplate>

I’m open to XAML code or C# (even better! I’m old school) or any suggestion.

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-06-01T19:02:19+00:00Added an answer on June 1, 2026 at 7:02 pm

    I would recommend that your Question object holds an additional property: SelectedOption

    This would be data bound to the SelectedItem of your combo box:

    <ComboBox x:Name="Options" Grid.Row="1" HorizontalAlignment="Left" Width="400"  Margin="10,0,10,0" 
                    Style="{StaticResource FlatComboBoxPaleYellow}"                              
                    ItemsSource="{Binding Path=QuestionOptions}" 
                    SelectedValuePath="OptionValue" 
                    DisplayMemberPath="OptionText"   
                    SelectedItem="{Binding Path=SelectedOption}"                      
                    SelectionChanged="Answer_SelectionChanged" />
    

    Then in your Survey object, for each Question in your Questions collection, find any of the Answers in the Result object that correspond to that question, lookup the corresponding QuestionOption on that question and assign it to the SelectedOption property of that Question object.

    public class Question : INotifyPropertyChanged
    {
        public QuestionOption SelectedOption
        {
            get
            {
                return _selectedOption;
            }
            set
            {
                if (value != _selectedOption)
                {
                    _myList = value;
                    OnPropertyChanged("SelectedOption");
                }
            }
        }
        private QuestionOption _selectedOption = new QuestionOption();
    
        // ... other properties ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.