Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two window,one have list of visitor,another to display it.How to display if I select one visitor(example SUNDAR) and display back on another page

Xaml Visitor

HTML
<ListView x:Name="listVisitor"  ItemsSource="{Binding}" HorizontalAlignment="Left" Height="582" Margin="110,65,0,0" VerticalAlignment="Top" Width="924" Grid.ColumnSpan="3" />

   <Button Content="View Visitor"  Foreground="white" HorizontalAlignment="Left" Margin="98,674,0,0" VerticalAlignment="Top" Width="320" Height="30" Background="#FF1CA0B7" Grid.ColumnSpan="2" Name="ViewBtn" Click="ViewBtn_Click" />


Code

C#
private void ViewBtn_Click(object sender, RoutedEventArgs e)
    {
        ViewList dialogBox = new ViewList();`
        Nullable<bool> dialogResult = dialogBox.ShowDialog();

    }


Xaml Viewlist

XML
<TextBox  Name="VisitorNo"/>
<TextBox Name="Name"/>


code

C#
private void VisitorNo_TextChanged(object sender, TextChangedEventArgs e)
   {

   }

   private void Name_TextChanged(object sender, TextChangedEventArgs e)
   {

   }

I already make connection from database for Visitor
How to display at both textbox?
Posted
Updated 16-Feb-15 22:07pm
v2
Comments
Herman<T>.Instance 17-Feb-15 4:07am    
What have you tried? What stops you from doing the task?

1 solution

You need to use EventAggretators in PRISM.

Once a value is selected in one window.The value will be binded to a property in the view model.

Publish the event with that selected value as a parameter in event object.

In the other window's view model listen/subscribe to the event and get the value from the event object parameter. Bind the value to the required dependency property in that window so that the value gets reflected in UI.

For communication between view models and this kinds of scenarios we need to use evenaggregators.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900