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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:25:33+00:00 2026-05-22T12:25:33+00:00

My xaml … <ListBox Margin=6,35,6,6 Name=lbLayers SelectionMode=Extended > <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation=Vertical> <TextBlock Text={Binding

  • 0

My xaml …

<ListBox Margin="6,35,6,6" Name="lbLayers" SelectionMode="Extended"    >
    <ListBox.ItemTemplate>
        <DataTemplate>
            <StackPanel Orientation="Vertical">
                <TextBlock Text="{Binding Key,Mode=TwoWay}" />
                <TextBlock Text="{Binding Value.Visible,Mode=TwoWay,StringFormat='Visible: {0}'}"  />
            </StackPanel>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox> 

.. and my code is …

   void GameEvents_MapCreated(object sender, Zider.EventArgs.MapEventArgs e)
    {
        HookMapLayerEvents(false);
        this.map = e.Map;
        HookMapLayerEvents(true);
         this.lbLayers.ItemsSource = this.map.Layers;
    }

this.map.layers is a generic dictionary of type (string, MapLayer(Tile))

When I set ItemSource on the listbox there are no items in the dictionary to start with. When I click a button that is when I add a map layer to

this.map.Layers.Add("key", new MapLayer<Tile>());

Also MapLayer implements INotifyPropertyChanged for it’s properties.

For the life of me I can’t seem to get the items to be displayed in the listbox.

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

    The problem is that the value of map.Layers doesn’t change nor does Dictionary<TKey, TValue> implement the INotifyCollectionChanged interface. Hence there is no way for the ListBox to know that any new item is available to display.

    If possible try change the Layers property so that it exposes a ObservableCollection<T> instead.

    Of course that could be a problem if you must have a dictionary. If you are only interested in ensuring Unique entries you could use a HastSet of the keys to manage that. If you need the Key for look up then if there are few items a sequential search should do reasonably well.

    A full blown solution might be to implement an ObservableDictionary that has both IDictionary<TKey, TValue> and INotifyCollectionChanged interfaces. There are a few about if you search for “ObservableDictionary Silverlight”, just be careful that they actually implement the correct interfaces, its not good if its “observable” but not in a way compatable with ItemsSource.

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

Sidebar

Related Questions

xaml <controls:TabControl x:Name=tabControlRoom Grid.Row=1 Grid.Column=1 d:LayoutOverrides=Width, Height ItemsSource={Binding} > <controls:TabControl.ItemTemplate> <DataTemplate> <controls:TabItem Header={Binding name}>
With xaml (notice the binding on dictionary entry Attributes[Welcome]): <Grid x:Name=LayoutRoot> <StackPanel> <TextBlock FontSize=36
Messages.xaml <TextBlock x:Name=txt_count_unreads Text=0 /> App.xaml check messages...and Messages mm = new Messages(); Messages.txt_count_unreads.Text
my xaml file <ListBox Height=522 HorizontalAlignment=Left Margin=20,162,0,0 Name=listBox1 VerticalAlignment=Top Width=448 ItemsSource={Binding}> <ListBox.ItemTemplate> <DataTemplate> <StackPanel
In XAML, if you insert <TextBlock Text=Hello World /> You will see the words
XAML <ListView Name=Panel Width=Auto Margin=0,200,0,0 HorizontalAlignment=Stretch VerticalAlignment=Stretch Background={x:Null} BorderThickness=0 ItemsSource={Binding Source={x:Static Communicator:Profile.AvailableFriends}} MouseDoubleClick=Panel_MouseDoubleClick ScrollViewer.HorizontalScrollBarVisibility=Disabled
Xaml code <DatePicker Grid.Column=0 Grid.Row=1 HorizontalAlignment=Left Margin=100,50,0,10 Name=dateText VerticalAlignment=Top Width=120 > <DatePicker.SelectedDate> <Binding Source={StaticResource
XAML: <dxe:ComboBoxEdit x:Name=UserSelectComboBox Margin=68.497,31.75,0,48.213 Background= {DynamicResource TextBoxBackground} Height={DynamicResource TextBoxHeight} FontSize={DynamicResource TextFontSize} HorizontalAlignment=Left Width=149.333 Text={Binding
the XAML of my window: <ListView Grid.Row=0 Name=files> <ListView.Resources> <DataTemplate x:Key=CheckboxTemplate> <CheckBox IsChecked={Binding Save,
the XAML of my window: <ListView Grid.Row=0 Name=files> <ListView.Resources> <DataTemplate x:Key=CheckboxTemplate> <CheckBox IsChecked={Binding Save,

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.