CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2011
    Posts
    4

    binding of datagridcomboboxcolumn problem

    Hi,
    i'm a newbie and i am trying to fill a datagrid with some data from my list of classes.

    I have 2 classes, clients and kal
    in the calvul class i have a klid that contains the id that corresponds with the Id from Clients

    the datagrid's datacontext is kal (it show some info + clientsname)
    so in my datagrid i want a dropdown with all the clients
    but it should show at startup the value thats is in my klid from kal
    but i can't figure out how to get this working...


    in my code i have
    KalenderGrid.DataContext = Kal;
    gezinColumn.ItemsSource = Klanten;


    my xaml-part looks like this :

    <DataGridComboBoxColumn Header="Gezin" Width="100" x:Name="gezinColumn"
    DisplayMemberPath="KlNaam" SelectedValuePath="Id" Selector.IsSelected="True"
    SelectedValueBinding="{Binding Path=Klanten}" >
    <DataGridComboBoxColumn.ElementStyle>
    <Style TargetType="{x:Type ComboBox}">
    <Setter Property="ItemsSource" Value="{Binding Path=Kal.Period1.klid, RelativeSource={RelativeSource AncestorType={x:Type Window}}}" />
    </Style>
    </DataGridComboBoxColumn.ElementStyle>
    </DataGridComboBoxColumn>

    it shows the column, but it is empty, when i click it open, i can see all my clients..

    could anyone point my in the right direction ?
    thanks in advance

  2. #2
    Join Date
    Nov 2011
    Posts
    4

    Re: binding of datagridcomboboxcolumn problem

    forgot : i'm using VS2010 C#

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured