Double click event on child node in Treeview control in WPF

tbreslin

New member
Joined
Apr 24, 2013
Messages
1
Programming Experience
1-3
<TreeView Grid.Column="0" Margin="0,-15,0,15" Grid.ColumnSpan="1">
02
<TreeViewItem Header="Custom"/>

03
<TreeViewItem Header="All Conferences"/>

04
<TreeViewItem Header="Atlantic Coast Conference" MouseDoubleClick="TreeViewItem_MouseDoubleClick_1">

05
<TreeViewItem Header="Atlantic" MouseDoubleClick="TreeViewItem_MouseDoubleClick"/>

06
<TreeViewItem Header="Coastal"/>

07
</TreeViewItem>

08
<TreeViewItem Header="Big 10"/>

09
<TreeViewItem Header="East"/>

10
<TreeViewItem Header="West"/>

11

12
<TreeViewItem Header="Big 12"/>

13
<TreeViewItem Header="American Athletic Conference"/>

14
<TreeViewItem Header="Conference USA">

15
<TreeViewItem Header="East"/>

16
<TreeViewItem Header="West"/>

17
</TreeViewItem>

18
<TreeViewItem Header="Mid American Conference">

19
<TreeViewItem Header="East"/>

20
<TreeViewItem Header="West"/>

21
</TreeViewItem>

22
<TreeViewItem Header="Mountain West Conference">

23
<TreeViewItem Header="Mountain"/>

24
<TreeViewItem Header="West"/>

25
</TreeViewItem>

26
<TreeViewItem Header="Pacific 12 Conference">

27
<TreeViewItem Header="North"/>

28
<TreeViewItem Header="South"/>

29
</TreeViewItem>

30
<TreeViewItem Header="Southeastern Conference">

31
<TreeViewItem Header="East"/>

32
<TreeViewItem Header="West"/>

33
</TreeViewItem>

34
<TreeViewItem Header="Sun Belt Conference"/>

35
<TreeViewItem Header="FBS Independents"/>

36
</TreeView>




01
private void TreeViewItem_MouseDoubleClick_1(object sender, MouseButtonEventArgs e)

02
{

03

04
FootballClassesDataContext objSample = new FootballClassesDataContext();

05
var result = from rslt in objSample.Statistics

06
where rslt.Conference == "ACC"

07
select rslt;

08
grdStatistics.ItemsSource = result.ToList();

09
}

10

11
private void TreeViewItem_MouseDoubleClick(object sender, MouseButtonEventArgs e)

12
{

13
FootballClassesDataContext objSample = new FootballClassesDataContext();

14
var result = from rslt in objSample.Statistics

15
where rslt.Conference == "ACC" && rslt.Division == "Atlantic"

16
select rslt;

17
grdStatistics.ItemsSource = result.ToList();

18

19
}





I am trying to do a LINQ Query by Double Clicking the child node. When I click on the parent node it brings up the correct data. But when I click on the child node it still brings up the data from the parent node. How do I get the child node to display the correct data?
 
Top Bottom