Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Selected item for mutilple datagrid's

$
0
0

Dear all, 

first of all please do not confuse with my question title.It is a single seleteditem on Multiple datagrid ( notmultipleselecteditems on a single datagrid

I have multiple datagrids ( say three ), each datagrid from the lowest depends for its data from the selecteditem from the above datagrid. 

I have asked questions on selecteditem on datagrid by populating the data from a sqlserver few weeks ago, and i managed to solve this issue with some answers.

http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/76ad5efe-0589-417d-9ffe-5c5911ffd520/#d884f0c8-a809-4358-b8e1-3b177ef3c48d

is it possible to use the same selecteditem of a datagrid on multiple datagrid's ? 

for example , in the previous problem it was only 1:1 datagrid, will it be possible to implement the same concept like there are three datagrids, 

one - Person
two- PersonDetails
Three- PersonStatus

when the user runs the application, 
---> first the Person datagrid loads by default (from the database)
---> Persondetails table data is displayed when a selecteditem is clicked on the Person datagrid  (achieved this already) after that 
---> PersonStatus table data should be displayed when the selecteditem is clicked on  Persondetails ?? ( is this possible, it is like a tree one after the other) 


This is my MainViewModel for the previous selecteditem 1:1 datagrid's

public class MainViewModel : BindableBase, INotifyPropertyChanged { public MainViewModel() { this.Persons = Person.GetPersons(); } // for Person Datagrid private ObservableCollection<Person> personValues; public ObservableCollection<Person> Persons { get { return personValues; } set { this.SetProperty<ObservableCollection<Person>>(ref this.personValues, value); } }

// for PersonDetail datagrid private ObservableCollection<PersonDetails> detailsvalues; public ObservableCollection<PersonDetails> Details { get { if (this.Selectedperson == null) { return null; } return this.LoadDetails(this.Selectedperson.PersonID); } } private ObservableCollection<PersonDetails> LoadDetails(int personID) { ObservableCollection<PersonDetails> details = new ObservableCollection<PersonDetails>(); foreach (PersonDetails detail in PersonDetails.GetDetails().Where(item => item.PersonID == personID)) { details.Add(detail); } return details; } private Person selectedPersonValue; public Person Selectedperson { get { return selectedPersonValue; } set { this.SetProperty<Person>(ref this.selectedPersonValue, value); this.RaiseNotification("Details"); } } }

any body suggest me to proceed further for the third datagrid. if somebody doesn't understand my question, pls tell me, i will try to explain it better.

Thanks







Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>