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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:16:15+00:00 2026-06-11T04:16:15+00:00

This is my first time using the UserControl in WPF. Following is my Usercontrol

  • 0

This is my first time using the UserControl in WPF. Following is my Usercontrol Xaml and background VB Code:

<UserControl x:Class="AddNewGenre"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d" d:DesignHeight="194" d:DesignWidth="405">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30" />
            <RowDefinition Height="130" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="72*" />
            <ColumnDefinition Width="333*" />
        </Grid.ColumnDefinitions>

        <ListBox Name="GenreListBox" ItemsSource="{Binding}"
                 Grid.Row="1" Grid.Column="1">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel IsItemsHost="True" />
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Image Source="{Binding Value}" Width="128" Height="128" />
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
</UserControl>

Code file:

Public Class AddNewGenre
    Dim Result As HODLib.Classes.GenreClass

    Public Sub New()

        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
        Me.DataContext = Result
    End Sub

    Private Sub UserControl_Loaded(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded

        GenreListBox.ItemsSource = GlobalValues.ImageDictionary
    End Sub

End Class

Following is the code that gets the GlobalValues.ImageDictionary:

Namespace GlobalValues
    Module CurrentVariables
        Public ImageDictionary As Concurrent.ConcurrentDictionary(Of String, BitmapImage)

        Public Sub Initialize()
            ImageDictionary = New Concurrent.ConcurrentDictionary(Of String, BitmapImage)

            'try get resources
            GetAllBitmaps()

        End Sub

        Public Sub GetAllBitmaps()
            Try
                ImageDictionary.Clear()
                With ImageDictionary
                    .TryAdd("Box", New BitmapImage(New Uri("Resources\Box.png", UriKind.Relative)))
                    .TryAdd("Tri", New BitmapImage(New Uri("Resources\Tri.png", UriKind.Relative)))
                End With
            Catch ex As Exception

            End Try
        End Sub

    End Module
End Namespace

The issue is that the images are not getting displayed in the imagelistbox, only a black item is getting displayed. Could you please tell me what is the wrong thing I did here.

  • 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-11T04:16:17+00:00Added an answer on June 11, 2026 at 4:16 am

    Finally found a answer from this post: Accessing Build Action Resource type files In my case I made value to string of format “/HOD;component/Resources/Box.png” rather than the BitmapImage

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

Sidebar

Related Questions

First, the code: <UserControl x:Class=Engage.IWS.Modules.InteractionResults.Views.InteractionResultView xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:mc=http://schemas.openxmlformats.org/markup-compatibility/2006 xmlns:i=clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity xmlns:cmd=clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras ... more here that
This is my first time using EA. I used it to generate a class
This is my first time using XML documents. What I'm trying to do is
This is my first time using this site and I am quite new to
This is my first time using lightbox which uses jquery framework. But when I
This is my first time using an external library, and I'm a bit nervous
This is my first time using jQuery and I am pleased to get my
This is my first time using Google Analytics Ecommerce Tracking to get data for
this is my first time using StAX for parsing XML documents (still in the
So this is my first time using cookies and i'm having some trouble setting

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.