开发者

Usercontrol with treeview selected event that refreshed another usercontrol not working

开发者 https://www.devze.com 2023-02-28 04:36 出处:网络
I\'m relatively new to WPF programming and can\'t seem to get this working correctly.This is in my mind something rather simplistic that i would like to get working so I didn\'t try the MVVM framework

I'm relatively new to WPF programming and can't seem to get this working correctly. This is in my mind something rather simplistic that i would like to get working so I didn't try the MVVM framework and decided to keep it simple.

I have a usercontrol treeview with report paths. I have another usercontrol with a reportviewer. Selecting a report path in the treeview should refresh the reportviewer.

I can "call" the method from the treeview usercontrol for refreshing the reportviewer in the report usercontrol but nothing happens.

I was reading other posts and some seem to suggest a button event to a delegate that will allow the other usercontrol method to be executed. I'm not using a button event so I'm a bit puzzled.

I thought I could do something like this:

 private void treeViewMenu_Selected(object sender, RoutedEventArgs e)
 {
    //Get the selected item
 开发者_如何学Go   ....
    //Call the method of another user control
    ReportUserControl ruc = new ReportUserControl();
    ruc.RefreshReport();
 }

Obviously that didn't work...I know that it shouldn't be too difficult but i am in a brain freeze moment and can't seem to get it working.

Any suggestions would be greatly appreciated. Thanks!

0

精彩评论

暂无评论...
验证码 换一张
取 消