回复 13楼bj_zm的帖子
最后按11楼的方法,用OlapGrid.SelectedItem强转成DataRow,然后传参数到OlapEngine.GetDetail()方法里。代码参考:
- // get OlapEngine to work with
- C1OlapGrid _olapGrid = _c1OlapPage.OlapGrid;
- // add event to display new details
- _olapGrid.AddHandler(MouseRightButtonDownEvent, new MouseButtonEventHandler((_s, _e) =>
- {
- // get OlapGrid information for the mouse position
- C1.Silverlight.FlexGrid.HitTestInfo hti = _olapGrid.HitTest(_e.GetPosition(_s as C1OlapGrid));
- // make sure we are working with a cell
- if (hti.CellType == C1.Silverlight.FlexGrid.CellType.Cell)
- {
- DataRowView row = _olapGrid.SelectedItem as DataRowView;
- var data = _c1OlapPage.OlapEngine.GetDetail(row.GetRow(), _c1OlapPage.OlapEngine.OlapTable.Columns[hti.Column].ColumnName);
- // create new details window and pass it data
- DetailsWindow details = new DetailsWindow(data);
- // shows new window
- details.Show();
- }
- }), true);
复制代码
Sample在附件里,我重写了右键弹出的Window,右键弹出的菜单改成了DetailsWindow.xaml.cs文件的样式。代码都测试过了。
你看看,估计要根据你的项目修改。
|