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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:51:35+00:00 2026-06-08T07:51:35+00:00

I am trying to do a binding as with following data formats: Public Structure

  • 0

I am trying to do a binding as with following data formats:

Public Structure ItemBase
    Property ID As String
    Property Description As String
End Structure

Namespace Classes
    Public Class StockEntityClass
        Implements INotifyPropertyChanged  
#Region "Property Variables"
        Property ID As String
        Property Namee As String
        Property Units As String
        Property ContactID As String
        Property SetCount As Integer
        Property VatOnMargin As Boolean
        Property Vat As Double
        Property Code As String
        Property _ContactNamee As String
#End Region

        Public Sub New()
            _IDValue = Now.ToString
            _NameeValue = ""
            _UnitsValue = "Pcs"
            _ContactIDValue = ""
            _SetCountValue = 0
            _VatOnMarginValue = False
            _VatValue = 14.5
            _CodeValue = ""
            _ContactNamee = ""
        End Sub    
    End Class
End Namespace

In my wpf xaml window which is DataContext to Stock Entity variable, I have a combo box that is bound to BindingList(of ItemBase) and the user will select an Item and that ItemID as to get assosiated to StockEntity.ContactID.

Following is the xaml code:

<ComboBox Name="VendorsComboBox" Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" DisplayMemberPath="Description" SelectedItem="{Binding Path=CustomerID}"/>

Following is Binding Code:

Dim Stock As Classes.StockEntityClass
VendorsComboBox.ItemsSource = Contacts.DBAccessFunctions.Get_ContactsByType_BaseList(DataSource, "Vendor")
        StockEntityStack.DataContext = Stock

Where StockEntityStack contains the UI part which is datacontext bind to stock variable.
Could you please tell me how to write the xaml databound to it.

  • 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-08T07:51:36+00:00Added an answer on June 8, 2026 at 7:51 am

    Try something like that:

    MainWindow (XAML file):

      <Window x:Class="MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" Height="350" Width="525">
            <StackPanel>
                <ComboBox ItemsSource="{Binding MySource}" 
                          SelectedValue="{Binding ContactID}"
                          DisplayMemberPath="Description"
                          SelectedValuePath="ID"
                          Width="180" Height="25"
                          />
    
                <StackPanel Orientation="Horizontal" Margin="10" >
                    <TextBlock Text="Selected ID:" />
                    <TextBlock Text="{Binding ContactID}" />
                </StackPanel>
            </StackPanel>
        </Window>
    

    MainWindow (code-behind file):

    Class MainWindow 
        Public Sub New()
            InitializeComponent()
            Me.DataContext = New MainViewModel()
        End Sub
    End Class
    

    MainViewModel file:

       Imports System.ComponentModel
    
    Public Class MainViewModel
        Implements INotifyPropertyChanged
    
    #Region "Fields"
        Private _selectedContactID As String = String.Empty
    #End Region
    
    
    #Region "Property Variables"
        Property MySource As List(Of ItemBase) = New List(Of ItemBase)
        Public Property ContactID As String
            Get
                Return _selectedContactID
            End Get
            Set(ByVal value As String)
                _selectedContactID = value
                OnPropertyChanged("ContactID")
            End Set
        End Property
    #End Region
    
        Public Sub New()
            MySource.Add(New ItemBase(1, "test1"))
            MySource.Add(New ItemBase(2, "test2"))
            MySource.Add(New ItemBase(3, "test3"))
            MySource.Add(New ItemBase(4, "test4"))
            MySource.Add(New ItemBase(5, "test5"))
        End Sub
    
        Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
    
        Protected Sub OnPropertyChanged(ByVal propertyName As String)
            RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propertyName))
        End Sub
    
    End Class
    
    
    Public Structure ItemBase
        Public Sub New( _
           ByVal _id As String,
           ByVal _description As String
           )
            ID = _id
            Description = _description
        End Sub
        Property ID As String
        Property Description As String
    End Structure
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to bind a ListBox's SelectedItem data to a property. The following code
I am trying to do the following: Data Binding in Combobox but with multi-binding..
I'm trying to retrieve activity data from webservice. Here's my webservice codes. public string
I am trying to set up the binding between Core Data, NSArraycountroller and a
I have an ScrollViewer that I am trying to do data binding on the
While trying to solve a two-way data binding problem in here , I found
I am trying to make a (very) simple Data Binding test, but it doesn't
I'm trying to figure out how data binding with BindingSource is supposed to work
I am trying to get the database values and binding to data table by
I am trying to Unmarshal the following xml: <datas xmlns=http://www... xmlns:atom=http://www.w3.org/2005/atom> <data> <atom:link rel=data

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.