How to Bind a Combo Box so that it retrieves and display content corresponding to the Id in a link table and populates itself with the data in the main table?

I am developing a desktop application in Wpf using MVVM and Entity Frameworks. I have the following tables:
1. Party (PartyId, Name)
2. Case (CaseId, CaseNo)
3. Petitioner (CaseId, PartyId) ............. Link Table
I am completely new to .Net and to begin with I download Microsoft's sample application and
following the pattern I have been successful in creating several tabs. The problem started only when I wanted to implement many-to-many relationship. The sample application has not covered the scenario where there can be a any-to-many relationship. However
with the help of MSDN forum I came to know about a link table and managed to solve entity framework issues pertaining to many-to-many relationship. Here is the screenshot of my application to show you what I have achieved so far.
And now the problem I want the forum to address is how to bind a combo box so that it retrieves Party.Name for the corresponding PartyId in the Link Table and also I want to populate it with Party.Name so that
users can choose one from the dropdown list to add or edit the petitioner.

Hello Barry,
Thanks a lot for responding to my query. As I am completely new to .Net and following the pattern of Microsoft's Employee Tracker sample it seems difficult to clearly understand the concept and implement it in a scenario which is different than what is in
the sample available at the link you supplied.
To get the idea of the thing here is my code behind of a view vBoxPetitioner:
<UserControl x:Class="CCIS.View.Case.vBoxPetitioner"
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"
xmlns:v="clr-namespace:CCIS.View.Case"
xmlns:vm="clr-namespace:CCIS.ViewModel.Case"
mc:Ignorable="d"
d:DesignWidth="300"
d:DesignHeight="200">
<UserControl.Resources>
<DataTemplate DataType="{x:Type vm:vmPetitioner}">
<v:vPetitioner Margin="0,2,0,0" />
</DataTemplate>
</UserControl.Resources>
<Grid>
<HeaderedContentControl>
<HeaderedContentControl.Header>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<TextBlock Margin="2">
<Hyperlink Command="{Binding Path=AddPetitionerCommand}">Add Petitioner</Hyperlink>
| <Hyperlink Command="{Binding Path=DeletePetitionerCommand}">Delete</Hyperlink>
</TextBlock>
</StackPanel>
</HeaderedContentControl.Header>
<ListBox BorderThickness="0" SelectedItem="{Binding Path=CurrentPetitioner, Mode=TwoWay}" ItemsSource="{Binding Path=tblParties}" />
</HeaderedContentControl>
</Grid>
</UserControl>
This part is working fine as it loads another view that is vPetioner perfectly in the manner I want it to be.
Here is the code of vmPetitioner, a ViewModel:
Imports Microsoft.VisualBasic
Imports System.Collections.ObjectModel
Imports System
Imports CCIS.Model.Party
Namespace CCIS.ViewModel.Case
''' <summary>
''' ViewModel of an individual Email
''' </summary>
Public Class vmPetitioner
Inherits vmParty
''' <summary>
''' The Email object backing this ViewModel
''' </summary>
Private petitioner As tblParty
''' <summary>
''' Initializes a new instance of the EmailViewModel class.
''' </summary>
''' <param name="detail">The underlying Email this ViewModel is to be based on</param>
Public Sub New(ByVal detail As tblParty)
If detail Is Nothing Then
Throw New ArgumentNullException("detail")
End If
Me.petitioner = detail
End Sub
''' <summary>
''' Gets the underlying Email this ViewModel is based on
''' </summary>
Public Overrides ReadOnly Property Model() As tblParty
Get
Return Me.petitioner
End Get
End Property
''' <summary>
''' Gets or sets the actual email address
''' </summary>
Public Property fldPartyId() As String
Get
Return Me.petitioner.fldPartyId
End Get
Set(ByVal value As String)
Me.petitioner.fldPartyId = value
Me.OnPropertyChanged("fldPartyId")
End Set
End Property
End Class
End Namespace
And below is the ViewMode vmParty which vmPetitioner Inherits:
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports CCIS.Model.Case
Imports CCIS.Model.Party
Imports CCIS.ViewModel.Helpers
Namespace CCIS.ViewModel.Case
''' <summary>
''' Common functionality for ViewModels of an individual ContactDetail
''' </summary>
Public MustInherit Class vmParty
Inherits ViewModelBase
''' <summary>
''' Gets the underlying ContactDetail this ViewModel is based on
''' </summary>
Public MustOverride ReadOnly Property Model() As tblParty
'''' <summary>
'''' Gets the underlying ContactDetail this ViewModel is based on
'''' </summary>
'Public MustOverride ReadOnly Property Model() As tblAdvocate
''' <summary>
''' Gets or sets the name of this department
''' </summary>
Public Property fldName() As String
Get
Return Me.Model.fldName
End Get
Set(ByVal value As String)
Me.Model.fldName = value
Me.OnPropertyChanged("fldName")
End Set
End Property
''' <summary>
''' Constructs a view model to represent the supplied ContactDetail
''' </summary>
''' <param name="detail">The detail to build a ViewModel for</param>
''' <returns>The constructed ViewModel, null if one can't be built</returns>
Public Shared Function BuildViewModel(ByVal detail As tblParty) As vmParty
If detail Is Nothing Then
Throw New ArgumentNullException("detail")
End If
Dim e As tblParty = TryCast(detail, tblParty)
If e IsNot Nothing Then
Return New vmPetitioner(e)
End If
Return Nothing
End Function
End Class
End Namespace
And final the code behind of the view vPetitioner:
<UserControl x:Class="CCIS.View.Case.vPetitioner"
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"
xmlns:vm="clr-namespace:CCIS.ViewModel.Case"
mc:Ignorable="d"
Width="300">
<UserControl.Resources>
<ResourceDictionary Source=".\CompactFormStyles.xaml" />
</UserControl.Resources>
<Grid>
<Border Style="{StaticResource DetailBorder}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Petitioner:" />
<ComboBox Grid.Column="1" Width="240" SelectedValuePath="." SelectedItem="{Binding Path=tblParty}" ItemsSource="{Binding Path=PetitionerLookup}" DisplayMemberPath="fldName" />
</Grid>
</Border>
</Grid>
</UserControl>
The problem, presumably, seems to be is that the binding path "PetitionerLookup" of the ItemSource of the Combo box in the view vPetitioner exists in a different ViewModel vmCase which serves as an ObservableCollection for MainViewModel. Therefore,
what I need to Know is how to route the binding path if it exists in a different ViewModel?
Sir, I look forward to your early reply bringing a workable solution to the problem I face. 
Warm Regards,
Arun

Similar Messages

  • How to pass a combo box parameter on reporting services?

    How to pass a combo box parameter on reporting services?
    For example, a report has a parameter which is a combo box, its items came from a database query.
    Looks like the combo box didn't got populated and greyed out if I didn't pass the parameter.

    Hi LAScorpion,
    In Reporting Services, if we want to pass a combo box parameter (means signal-parameter) from one report (main report) to another report (subreport), we can enable an action with “Go to report” or “Go to URL” option to achieve the requirement. For more details,
    please see:
    Method1: Go to report
    Right-click a report item to open the properties dialog in subreport, click Action in the left pane.
    Enable Go to report action, then select the main report name in the drop-down list.
    Add a parameter as below:
    Select ID (a parameter name from main report) in the drop-down list of Name, and select [ID] (a field name from subreport) in the drop-down list of Value.
    Method2: Go to URL
    Right-click a report item to open the properties dialog in subreport, click Action in the left pane.
    Enable Go to URL action, the URL below is for your reference:
    ="javascript:void(window.open('http://server_name/ReportServer/Pages/ReportViewer.aspx?%2ffolder_name%2fmain_report_name&rs:Command=Render&parameter_name="& Parameters!parameter_name.Value &"'))"
    Besides, if the parameter’s values are based on other parameters, then the combo-box got greyed out when we haven’t select values in preceding parameters. For more details, please see:
    Cascading Parameters
    If there are any misunderstanding, please elaborate the issue for further investigation.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How to bind a combo pane

    how to bind a combo pane????I'm trying to do it in same manner as combo bt its giving an error:unable to cast system-com.....
    Thanks..

    oItem = oItems.Add("3", SAPbouiCOM.BoFormItemTypes.it_PANE_COMBO_BOX)
            oItem.Top = 10
            oItem.Left = 10
            oItem.Width = 70
            oItem.Height = 19
            Dim oComoPane As SAPbouiCOM.PaneComboBox = Nothing
            oComoPane = oItem.Specific
            oComoPane.ValidValues.Add("A", "Desc A")
            oComoPane.ValidValues.Add("B", "Desc B")
            Dim oUsrDS As SAPbouiCOM.UserDataSource
            oUsrDS = oForm.DataSources.UserDataSources.Add("UDS", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 1)
            oComoPane.DataBind.SetBound(True, "", "UDS")
            oUsrDS.ValueEx = "A"
    Kind Regards
    -Yatsea

  • When i change the value of a combo box using a property node it displays the value not the item label

    I am using a combo box as a select list for text serial commands.  I have items like "engineering", "GUI", and "Scan" for the commands "MDE", "MDN", and MDS respectively which i have input as the corresponding value in the combo box.  so for example the label "engineering" has the value "MDE" in the combo box items list.  when the Vi starts it needs to read the current value MDE, MDN, or MDS and then i want it to display on the front panel the item text corresponding to that command value.
    To do this i have tried to read the serial command, ie MDS and then wire that to a "value" property of a property node of the combo-box, but instead of displaying the corresponding item label, "Scan", it displays the value "MDS" on the front panel instead.  i want the front panel to use the label text when choosing and displaying but the block diagram to use the serial commands.  Can this be done with a combo box?  I'm trying to use a combo box so i can keep it all text and avoid having to build a case statement to convert enums or rings from a numerical value to the text command.
    The correct text value is wired to the value property and it does exist in the combo-box.  I have unchecked "values match items" and selected to not allow undefined values.

    Don't use the value property node.  Use the Text.Text property node.  When creating the property node, select Text, then in the next pop-up box, select Text.
    - tbob
    Inventor of the WORM Global

  • HT2731 How can I change my store to US, now that I am in the US? A link in a previous thread says not accessible as the profile still shows different country..

    How can I change my store to US, now that I am in the US? A link in a previous thread says not accessible as the profile still shows different country..

    As long as you have a form of payment (credit or debit card) with a USA source, and with a billing address in the USA, then you just need to change your payment information on your account to that, change your country in the store settings, and you will then be able to shop in the USA store.
    Your AppleID will work in any country's store, as long as your payment source and billing addres are also specific to that country (and you are in that country as well, as there may be IP filters in place to stop use outside of the country).

  • How do i get back my playlists that have disappeared!!! they were backed up both on my laptop and the cloud

    how do i get back my playlists that have disappeared!!! they were backed up both on my laptop and the cloud

    Are you signed into itunes with your email address?  Purchases that are made through itunes are tied to the email address on your account.  If someone else logged in then your purchases wouldn't show. 
    When you go to the itunes store look at the black/gray bar at the top.  On the left is the email address that is signed in.  If it's incorrect just click on it and select "Sign Out."  When you sign back in all should be well.

  • I have a large number of photos imported into iPhoto with the dates wrong.  How can I adjust multiple photos (with varying dates) to the same, correct, date?

    I have a large number of photos imported into iPhoto with the dates wrong.  How can I adjust multiple photos (with varying dates) to the same, correct, date?

    If I understand you correctly, when you enter a date in the Adjust Date and Time window, the picture does not update with the date you enter.  If that is the case then something is wrong with iPhoto or your perhaps your library.
    How large a date change are you putting in?  iPhoto currently has an issue with date changes beyond about 60 years at a time.  If the difference between the current date on the image and the date you are entering is beyond that range that may explain why this is not working.
    If that is not the case:
    Remove the following to the trash and restart the computer and try again:
    Home > Library > Caches > com.apple.iphoto
    Home > Library > Preferences > com.apple.iPhoto (There may be more than one. Remove them all.)
    ---NOTE: to get to the "home > library" hold down option on the keyboard and click on "Go" > "Library" while in the Finder.
    Let me know the results.

  • I have just bought an ipod classic, I already have an ipod nano.  The new ipod was connected to the computer to charge and it named itself with my name on the old nano, how do I get the computer to recognise the new one

    I have just bought an ipod classic, I already have an ipod nano.  The new ipod was connected to the computer to charge and it named itself with my name on the old nano, how do I get the computer to recognise the new one?

    My mistake, it was nothing to do with format.  It woldn't sync because my movies were HD.  HD movies won't sync to an iopd classic 160 GB but when you purchase a HD movie, itunes gives you a SD vervsion of the movie which is compatible with the ipod.  Just needed to go to store, click movies, click purchased and untick the HD box and there you have the SD versions.  Download the SD versions and then sync your ipod and bobs you uncle, movies are on the ipod

  • How do I sync my old iPhone 5 to a new laptop PC without losing any iPhone data? The "remove and sync?" option looks like it will leave me with zero data on the iPhone!

    how do I sync my iPhone 5 to a new Toshiba laptop PC without losing any iPhone data? The "remove and sync?" option looks like it will leave me with zero data on the iPhone!

    See Recover your iTunes library from your iPod or iOS device.
    tt2

  • How to change screen combo box value from a method?

    Hi,
    I have a screen that has a combo box and an ALV.
    the combo box has the line numbers of the data in the ALV.
    you can select the line item and then the ALV changes...
    I fill the combo with function VRM_SET_VALUE.
    all is good once the user changes the combo box.
    I want to enable the user to click (hotspot) on ALV and then to ... and to change the value of the combo box to the line number he clicked on.
    I couldn't change the value inside that box.
    The combo box is declared as global parameter.
    when I assign a value to it inside the method, it is good. but once back to PAI, it is the old value.
    Do you have any idea how to set up that value?
    Thanks.

    Itay,
    When you load the combo box, you should be setting a "key" for each entry in the combo box.
    See below:
      move '2010FY' to Value-Key.
      move '2010 - Full Year' to Value-Text.
      append value to list.
      move '2010Q1' to Value-Key.
      move '2010 - Q1' to Value-Text.
      append value to list.
      move '2010Q2' to Value-Key.
      move '2010 - Q2' to Value-Text.
      append value to list.
      move '2010Q3' to Value-Key.
      move '2010 - Q3' to Value-Text.
      append value to list.
      move '2010Q4' to Value-Key.
      move '2010 - Q4' to Value-Text.
      append value to list.
      move 'COMBO1' to name.  "name of Combo box in the screen
      call function 'VRM_SET_VALUES'
        exporting
          id = name
          values = list.
    So add these "keys" to a hidden column in the ALV grid.  Then .... when the user presses a hotspot, pass the value of the hidden column (for the selected row) into the COMBO1 box.
      move '2010'FY' into Combo1.  " if they selected Full Year of 2010

  • Enumeration binding for combo box - missing feature

    Hi,
    In our application, combo boxes are usually employed for similar purpose as radio button groups: provide the end-user with an exclusive, static list of choices.
    Unfortunately, JUComboBoxBinding.createEnumerationBinding method does not seem to follow the same paradigm as JUButtonGroupBinding.createEnumerationBinding.
    In fact, for JUButtonGroupBinding, one parameter is "AbstractButton[] buttons", which is used for display purposes (end-user descriptions of the choices), and another is "Object[] valueList", which is the list of values for the corresponding attribute (usually, the valid values in the database for the column).
    Meanwhile, JUComboBoxBinding is only receiving one array parameter, "Object[] values", which is used both for display purposes and for database values... This approach is very restrictive, as long as we expect to display in the combo box a descriptive text for the coded value in the database (and localizable, as well!).
    Is this a known bug, or am I the first one to have noticed it? Is there any schedule for making this feature available?
    Thanks,
    Adrian

    I'm not sure where my last reply went, so another try.
    Unfortunately, I have the same feeling as usual, that my posted messages are not carefully read...
    The main issue was the comparison between JUComboBoxBinding and JUButtonGroupBinding, and my question was about the possible future availability of a feature. Nothing about this in the answer...
    Could I have an aswer to my original message, please?JUButtonGroupBinding is a custom control provided by JClient and has an api to let a user 'provide' custom Button objects instead of the default 'RadioButton's that would get created if none is passed in. The fact that you could use that to perform LOV kind of indirection of displaying a value other than what's set is 'a side-effect' of the original intention.
    FYI, we already implemented an extension to JUComboBoxBinding which is just doing what I was asking for. It is not complex at all:( I was only thinking that it might be useful also in standard...The 'standard' way of getting this behavior you're asking for is to create a programmatic VO as suggested above, with both display/update attribute values and bind it to the ComboBox as an LOV Binding. And yes you can certainly create custom controls extending Swing and use the existing bindings or 'extend' them as per an application need.
    Regards,
    Adrian

  • How to animate a combo box?

    I have a combo box that get's populated from a web service.
    This may happen in the background as the user is doing other tasks.
    I would like the combo box to jiggle or bounce up and down
    when it receives it's data. Can anyone offer some insights into how
    to do this?

    Thanks for the suggestions all. I found the rotate effect to
    work just great. Here is the code I used for anyone else that's
    interested:
    In my web service call that updates the combo box, I declare
    the jiggle function on the result:
    <mx:operation name="getControlsProjects"
    resultFormat="object" result="jiggleComboBox()">
    public function jiggleComboBox() : void
    cbxProjects.visible=true;
    jiggleStart.play();
    ]]>
    </mx:Script>
    <mx:Rotate id="jiggleStart" target="{cbxProjects}"
    angleTo="3" effectEnd="jiggleEnd.play()" duration="100"
    repeatCount="10"/>
    <mx:Rotate id="jiggleEnd" target="{cbxProjects}"
    angleTo="-3" effectEnd="jiggleReset.play()" duration="100"/>
    <mx:Rotate id="jiggleReset" target="{cbxProjects}"
    angleTo="0"/>
    I love to watch that combo box jiggle up and down. LOL
    Thanks again all!

  • How to modify a combo box for touch panel operation?

    Hi, 
    I'm developping a touch panel controled application.
    The first step of the application is user log-in. My application has a small database of names that the user can access via the drop down menu of a combo box. 
    My problem is that the arrows and the slider of the vertical scroll bar are way too small to be fingers-operated:
    Is there a way to modify the size of this scrollbar so that it's not too small for the operators' fingers?
    Best regards,
    peper

    Hello peper,
    As far as I know this is not directly possible (a least not with the control editor).
    If you want to, you could also create your own "adapted" control yourself through an XControl.
    This one can then (for example) combine a name input, a button and a listbox (with a big vertical scrollbar).
    Or is this too far fetched?
    Kind Regards,
    Thierry C - Applications Engineering Specialist Northern European Region - National Instruments
    CLD, CTA
    If someone helped you, let them know. Mark as solved and/or give a kudo.

  • How to use one Combo Box to control Two spreadsheet/charts in Web Analysis

    In Web Analysis panel, I have one data grid and one chart (two different data sources). I would like to have one combo box, e.g. Q1, Q2, Q3, Q4, in the selection (drop-down). When I select Q1, I would like to show Jan, Feb, Mar, Q1 ( ICHILDREN(Q1)) in my chart, and also only Q1 in my data grid.
    Any suggestions?
    Thanks

    I believe you can do this. For example you want to have a Chart and Graph linked to a drop down for products. When you select a product, the two POV's will change on the reports.
    Look at Panels in WA. I create a report with three panels. Make the first panel top aligned, the second top aligned and the third stretched. This should make the report "stretchy". Then add your dropdown to one panel and your reports to the other two panels.
    Finally link the reports to dropdown using the re-linking technique mentioned in the previous post.
    Hope this helps.
    Brian Chow

  • Help with linking combo boxes so that some options are made unavailable

    Hello!
    I'm having trouble setting up an interactive PDF form with multiple combo boxes.
    I have designed an interactive PDF form in InDesign CS6 but am doing the final preparation and formatting in Adobe Acrobat XI Pro.
    First of all, I am not sure if I should be using combo boxes or list boxes, but the combo box seemd to look better after I export the PDF and also left the field blank, ready for selection from the drop-down menu.
    Basically I have a list of drop-down lists, but not all combinations are compatible. For example, after maing "Selection 1" in "Combo box 1", I need only "Selection 1", "2", and "3" [out of the total 5] to be available in "Combo box 2".
    I need to be able to apply this algorhythm to the next few combo boxes as well.
    Moreover, I would need some of the checkboxes disabled [the user won't be able to check them at all]when I make a certain selection in some of the combo boxes.
    Needless to say, I don't know any Java, coding or making calculations in LiveCycle Designer, so I don't even know where to begin.
    I have attached a screen grab of my form and what I want to achieve.
    Any help would be very much appreciated.
    Thank you!

    If it is static data, I would suggest you to cache it rather than having it in each of the user session. You can have configuration/code to refresh when needed. Please look at any available caching frameworks (EhCache, OSCache etc...)

Maybe you are looking for

  • HP PSC 2510 on BEFW11S4: assigning / reserving an IP address

    I use an HP PSC 2510 printer / scanner copier on my home network, with a wired connection to my BEFW11S4 ver. 2 (firmware 1.45.10). About two months ago, I started experiencing intermittent connectivity problems (for which I asked assistance in a sep

  • Charger is not working properly

    Hi, after 10.9.2 update my charger is not working properly. First I thought the problem was the charger itself had died, but then I saw a pale light. I searched here and found that resetting SMC could be a solution. It worked for a while, but now the

  • How to test integrated configuration?

    Hi, I've set up an Integrated Configuration.(ICO) I know i cannot test from Tools >> Test Configuration I'm testing from RWB, i suppose i have to put my xml using the adapter engine test message option instead of the integration engine test option. Y

  • Receiver FCC

    Hi All, I am having an issue in reciever FCC, where my last field being 10 space and each record is separeted by a new line, the last field gets trimmed for the space, Could you provide your inputs. For example, my output record shd be like, without

  • Droid X - Clear all Contact History

    Verizon, will you be updating system soon to be deleting the so many histories in the contact listings?  No need for this feature, at first I thought all my contacts were doublicating until I realized I can scroll to left or right....also a Manual re