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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:37:25+00:00 2026-05-17T23:37:25+00:00

We’re using Caliburn.Micro/Silverlight 4 and life is good. I’m trying to bind a combobox’s

  • 0

We’re using Caliburn.Micro/Silverlight 4 and life is good.

I’m trying to bind a combobox’s itemsSource to a viewModel, but this doesn’t seem possible since the combobox is already bound to its own row’s dataItem. The logic which fills the combo changes with other data on the screen so I can’t really use a static list like I’ve been using.

Is there a way to bind directory to the viewModel somehow??? I’ve tried element to element binding but this never appears to work within the grid.

       <Controls:DataGridTemplateColumn x:Name="FooNameCol" Header="Foo" MinWidth="200">
            <Controls:DataGridTemplateColumn.CellTemplate>
                <DataTemplate>

                    <StackPanel>
                        <TextBlock Text="{Binding Path=Foo.ShortName}" 
                                   Style="{StaticResource DataGridTextColumnStyle}"/>
                    </StackPanel>

                </DataTemplate>
            </Controls:DataGridTemplateColumn.CellTemplate>
            <Controls:DataGridTemplateColumn.CellEditingTemplate>
                <DataTemplate>

                    <ComboBox DisplayMemberPath="ShortName"   
                              MinWidth="200" MinHeight="25"
                              SelectedItem="{Binding Path=Officer, Mode=TwoWay, ValidatesOnExceptions=True, NotifyOnValidationError=True}"
                              ItemsSource="{Binding Officers, Source={StaticResource ReferenceListRetriever}}" />

                </DataTemplate>
            </Controls:DataGridTemplateColumn.CellEditingTemplate>
        </Controls:DataGridTemplateColumn>
  • 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-17T23:37:25+00:00Added an answer on May 17, 2026 at 11:37 pm

    Within a DataTemplate, the DataContext is bound to each single item of the corresponding list; since all Bindings implicitly refers to DataContext, you have to ensure that the path is valid, starting from the single data item.

    In your scenario, for the indicated binding to work, you should have a VM shaped this way:

    public class MyVM {
       public IEnumerable<MyItem> Items {get;}
    }
    
    public class MyItem {
      public Foo Foo {get;}
      public Officer Officer {get;set;}
      public IEnumerable<Officer> Officers {get;}
    }
    

    It may seem an overkill, but in some scenarios each combo can actually contain different choices for each data item, based on some business rule.
    In simpler cases MyItem can just expose a common list coming from the parent MyVM:

    public class MyItem {
      ...
      public IEnumerable<Officer> Officers {
        get { return _parent.AvailableOfficers; }
      }
    }
    

    If you really can’t live with it and prefer to keep the available Officers list in the root VM only, you can use a Xaml side trick:

    public class MyVM {
      public IEnumerable<MyItem> Items {get;}
      public IEnumerable<Officer> Officers {get;}
    }
    
    public class MyItem {
      public Foo Foo {get;}
      public Officer Officer {get;set;}
    }
    

    Xaml:

    <UserControl ...>
      ...
      <AnyFrameworkElementAtThisLevel Name="bridge" />
      ...
      <Controls:WhateverGrid>
         ...
         <Controls:DataGridTemplateColumn ...>
            <Controls:DataGridTemplateColumn.CellTemplate>
                <DataTemplate>
                  ...
                </DataTemplate>
            </Controls:DataGridTemplateColumn.CellTemplate>
            <Controls:DataGridTemplateColumn.CellEditingTemplate>
                <DataTemplate>
                    <ComboBox DisplayMemberPath="ShortName"   
                              SelectedItem="{Binding Path=Officer, Mode=TwoWay, ValidatesOnExceptions=True, NotifyOnValidationError=True}"
                              ItemsSource="{Binding DataContext.Officers, ElementName=bridge}" />
    
                </DataTemplate>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
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 am trying to understand how to use SyndicationItem to display feed which is
I am reading a book about Javascript and jQuery and using 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.