Windows Vista Forums

ComboBox Binding to DataClass
  1. #1


    Horst Klein Guest

    ComboBox Binding to DataClass

    I use a custom LoginCommandData Class to initalize a LoginDialog.

    Public Class LoginCommandData
    Inherits DependencyObject
    Implements ComponentModel.INotifyPropertyChanged

    Private m_Mandators As IList
    Private m_Mandator As Common.Data.Mandator

    Public Property Mandators() As IList
    Get
    Return m_Mandators
    End Get
    Set(ByVal value As IList)
    Dim oldValue As IList = m_Mandators
    m_Mandators = value
    OnCommandDataPropertyChanged(New
    ComponentModel.PropertyChangedEventArgs("Mandators"))
    End Set
    End Property

    Public Property Mandator() As Vito64.Common.Data.Mandator
    Get
    Return m_Mandator
    End Get
    Set(ByVal value As Vito64.Common.Data.Mandator)
    Dim oldValue As Vito64.Common.Data.Mandator = m_Mandator
    m_Mandator = value
    If Not Equals(oldValue, m_Mandators) Then
    OnCommandDataPropertyChanged(New
    ComponentModel.PropertyChangedEventArgs("Mandator"))
    End If
    End Set
    End Property





    The Login-Xaml

    <Window.Resources>
    <VFC:LoginCommandData x:Key="LoginData" Password="MyPasswordBox" />
    </Window.Resources>


    <Grid x:Name="MyGrid" DataContext="{StaticResource LoginData}">
    <Label Content="Mandant" x:Name="LabelMandant" Height="23"/>
    <ComboBox Margin="206,143,82,126" IsSynchronizedWithCurrentItem="True"
    x:Name="ComboBoxMandator"
    DisplayMemberPath="Name" SelectedValuePath="Id"
    ItemsSource="{Binding Path=Mandators}"
    SelectedValue="{Binding Path=Mandator,
    Mode=TwoWay,
    UpdateSourceTrigger=PropertyChanged}">
    </ComboBox>
    </Grid>

    All I want is that the "Mantator" Property will be set, if it is selected in
    the ComboBox
    But it dosn't work.

    Who can tell me why?


      My System SpecsSystem Spec

  2. #2


    Horst Klein Guest

    RE: ComboBox Binding to DataClass

      My System SpecsSystem Spec

ComboBox Binding to DataClass problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
binding to combobox itemssource? dave .NET General 2 17 Jul 2009
Binding Problem in ComboBox Horst Klein Avalon 0 13 Sep 2007
WPF ListView data binding with embedded ComboBox Krish_xx Avalon 1 01 Jun 2007
Two-way binding doesn't work with ComboBox.Text? Keith Patrick Avalon 0 02 Nov 2006
Binding a ComboBox to in internal property Keith Patrick Avalon 2 04 Oct 2006