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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:44:12+00:00 2026-05-26T16:44:12+00:00

I have a ribbon combob box as: <r:RibbonComboBox DataContext=this SelectionBoxWidth=62 VerticalAlignment=Center IsEditable=True Label=Saved Queries

  • 0

I have a ribbon combob box as:

<r:RibbonComboBox DataContext="this"
                  SelectionBoxWidth="62"
                  VerticalAlignment="Center" 
                  IsEditable="True"  
                  Label="Saved Queries" 
                  Name="Saved_Queries"  
                  ToolTip="Select an item to run or edit" >
<r:RibbonGallery 
                  MaxColumnCount="1" 
                  Name="RibbonQu" 
                  ScrollViewer.VerticalScrollBarVisibility="Auto"
                  SelectionChanged="RibbonGallery_SelectionChanged" >
     <r:RibbonGalleryCategory ItemsSource="{Binding SavedXml}" >
            <r:RibbonGalleryItem Content="Green" Foreground="Green" />
            <r:RibbonGalleryItem Content="Blue" Foreground="Blue" />
            <r:RibbonGalleryItem Content="Orange" Foreground="Orange" />
     </r:RibbonGalleryCategory>
 </r:RibbonGallery>

I need to bind the items of the comobobox to an observable collection as follows:

private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        XmlDocument doc = new XmlDocument();
        doc.Load("QueryList.xml");

        XmlNodeList List = doc.SelectNodes("//Query");

        foreach (XmlElement element in List)
        {

            if (element == null) return;
            if (element != null)
            {
                //Saved_Queries.Items.Add(element.InnerText);

                _savedxml.Add(element.InnerText.ToString());  
            }
        }
    }
    public ObservableCollection<string> SavedXml
    {
        get { return _savedxml; }
    set{}
    }

But i do not see anything in the comobox when i run it.I think the problem is with the data context, which has been set to others in the code, hence in the combobox i use :
DataContext=”this”
but im still not able to achieve anything. how can i go about this? 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-26T16:44:12+00:00Added an answer on May 26, 2026 at 4:44 pm

    As you suspected, you assign DataContext wrongly.

    If you need the combo to just have the items in SavedXml, and not actually need to set its DataContext, try removing DataContext="this" and adding ItemsSource="{Binding SavedXml, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}".

    If you do need to set the DataContext, change the assignment to: DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}" and then ItemsSource="{Binding SavedXml}".

    In both cases, since SavedXml is not a dependency property and it’s not using INotifyProperty changed interface, you have to fill the items before InitializeComponent() is run. Event better: make SavedXml a DependencyProperty.

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

Sidebar

Related Questions

I have been following the example on the bottom of this page: http://msdn.microsoft.com/en-us/library/microsoft.windows.controls.ribbon.ribbonapplicationmenu.auxiliarypanecontent.aspx to
I have application with WPF Ribbon and Grid. And I need to show this
So I'm having this strange problem. I have a ribbon moving behind the navigation
What experience have you had with introducing a Ribbon style control to legacy MFC
Have you managed to get Aptana Studio debugging to work? I tried following this,
I have been playing with the new Microsoft Ribbon for WPF and looking at
I have a ribbon in my application with a contextual tab. I have managed
I have a CMFCRibbonUndoButton on the ribbon of an MFC application. I have a
I have the following xaml in my ui: <ribbon:RibbonGallery SelectedValue={Binding Text} SelectedValuePath=Content SelectedItem={Binding SelectedRemark,
I have a ribbon type header on the top of my website: #top-wrapper {

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.