views:

18

answers:

1

I have a rather complicated Binding situation. I have a solution that I created in windows forms for this back in VS2005, but now I am recreating the control using wpf, but I am not doing it in exactly the same way I had done it before.

I have a listbox control that has the following DataTemplate:

<DataTemplate>
  <Border CornerRadius="5" BorderBrush="Black" BorderThickness="1">
    <StackPanel>
      <TextBlock x:Name="TaxonomyCode" Margin="2" FontWeight="Bold"
      FontSize="12">
        <TextBlock.Text>
          <MultiBinding StringFormat="{}{0}{1}{2}X">
            <Binding Path="TaxonomyTypeID" />
            <Binding Path="TaxonomyClassificationID" />
            <Binding Path="TaxonomySpecializationID" />
          </MultiBinding>
        </TextBlock.Text>
      </TextBlock>
      <TextBlock Margin="2"
      Text="{Binding ElementName=TaxonomyCode,Path=Text,Converter={StaticResource TaxonomyCodeToDescriptionConverter}}" />
    </StackPanel>
  </Border>
</DataTemplate>

Below that I have 3 listboxes that list the actual Taxonomy Hierarchies using properties on my ViewModel...

<ListBox 
    Grid.Column="0" Grid.Row="1" 
    ItemsSource="{Binding TaxonomyTypeLUT}" 
    DisplayMemberPath="IDDescription" 
    SelectedItem="{Binding Path=SelectedTaxonomyType}" />
<ListBox 
    Grid.Column="1" Grid.Row="1"
    ItemsSource="{Binding SelectedTaxonomyType.TaxonomyClassifications}"
    DisplayMemberPath="IDDescription"
    SelectedItem="{Binding Path=SelectedTaxonomyClassification}" />
<ListBox 
    Grid.Column="2" Grid.Row="1"
    ItemsSource="{Binding SelectedTaxonomyClassification.TaxonomySpecializations}"
    DisplayMemberPath="IDDescription"
    SelectedItem="{Binding SelectedTaxonomySpecializations}" />

The actual datatbase binding is kindof complex as well. With multiple keys for each table in the hierarchy because each table can contain the same key that belongs to different parents... for example

taxonomy code : 207R00000X which breaks down to: 20 7R 00000 translates to: Allopathic,internal medicine,internal medicine taxonomy code : 208M00000X which breaks down to: 20 8M 00000 translates to: allopathic, hospitalist, hospitalist

Each of those break downs is the keyfield in its own table.

alt text

Here is the design of my tables...Any suggestions are greatly appreciated.

I am trying to have my lower control change each child as a new selection is made. I have that working. Now though when I select the top list, I want the bottom lists to reflect the Taxonomy of the selected item. I can get that done too by binding One-Way.

If I dont bind oneway I get this ErrorMessage:"The property 'TaxonomySpecializationID' is part of the object's key information and cannot be modified."

Ideally what I want to be able to do, is change the taxonomy of the selected DoctorTaxonomy using the listboxes. Maybe it just wont work...

A: 

The way I got around this was to create a new item with then needed value, Delete the original value from the collection, and insert the new item.

ecathell