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

The Archive Base Latest Questions

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

I have one main outstanding issue, I know now how to databind to lists

  • 0

I have one main outstanding issue, I know now how to databind to lists and individual items, but there is one more problem I have with this, I need to bind a listbox to some properties that are in a Class.
For Example I have two Properties that are bound in some XAML in a class called Display:

Public Property ShowEventStart() As Visibility
Public Property ShowEventEnd() As Visibility

I can use these in my XAML but I want them to be in a ListBox/Drop-down List, how can I have my properties show in this list and be able to change their values, does it have to be a List to be in a List?
I just want to be able to modify these properties from a Drop-down list to toggle the Visibility of the ShowEventStart and ShowEventEnd Property Values using the Checkboxes in the Drop-down List.

Plus this must be a Silverlight 3.0 solution, I cannot figure out how to have something that can be bound in the XAML which is not a list and then bound it as a list to modify these items!

I just need a list of Checkboxes which alter the values of the Class Properties such as ShowEventStart and ShowEventEnd, there are other properties but this will be a start.

  • 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-12T12:17:26+00:00Added an answer on May 12, 2026 at 12:17 pm

    You can create a PropertyWrapper class and in you window code behind expose a property that returns a List<PropertyWrapper> and bind your ListBox.ItemsSource to it.

    public class PropertyWrapper
     {
      private readonly object target;
      private readonly PropertyInfo property;
    
      public PropertyWrapper(object target, PropertyInfo property)
      {
       this.target = target;
       this.property = property;
      }
    
      public bool Value
      {
       get
       {
        return (bool) property.GetValue(target, null);
       }
       set
       {
        property.SetValue(target, value, null);
       }
      }
    
      public PropertyInfo Property
      {
       get
       {
        return this.property;
       }
      }
     }
    

    your window code behind:

    public partial class Window1 : Window, INotifyPropertyChanged
     {
    public Window1()
      {
       InitializeComponent();
    
       properties = new List<PropertyWrapper>
                     {
                      new PropertyWrapper(this, typeof(Window1).GetProperty("A")),
            new PropertyWrapper(this, typeof(Window1).GetProperty("B")),
                     };
    
       this.DataContext = this;
      }
    
      private List<PropertyWrapper> properties;
      public List<PropertyWrapper> Properties
      {
       get { return properties; }
      }
    
    
      private bool a;
    
      private bool b = true;
    
      public bool A
      {
       get
       {
        return a;
       }
       set
       {
        if (value != a)
        {
         a = value;
         NotifyPropertyChange("A");
        }
       }
      }
    
      public bool B
      {
       get
       {
        return b;
       }
       set
       {
        if (value != b)
        {
         b = value;
         NotifyPropertyChange("B");
        }
       }
      }
    
      protected void NotifyPropertyChange(string propertyName)
      {
       if (PropertyChanged != null)
       {
        PropertyChanged.Invoke(
         this, new PropertyChangedEventArgs(propertyName));
       }
      }
    
      public event PropertyChangedEventHandler PropertyChanged;
     }
    

    your window markup:

                <ListBox ItemsSource="{Binding Path=Properties}">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="{Binding Path=Property.Name}"/>
                                <CheckBox IsChecked="{Binding Path=Value}" />
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
    

    Hope this helps

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

Sidebar

Related Questions

I have WPF application with one main window . In this window there are
I have one Main class and VOCollection Class. in main class there is a
I have one more problem. I am working on migrating one big system (what
I have one main parent swf that loads several other swfs. If something happens
I have WPF Application where I have One main form and other user controls
I have a WinForms TreeView with one main node and several sub-nodes. How can
When I have one app.config in my main project I always have to duplicate
With a distributed application, where you have lots of clients and one main server,
I have an application that has two threads. The first one (the main thread)
I'm using the jQuery Validation JS I have two contact forms, the main one

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.