两点:
①:给该控件起个奇葩点的名字(目的是不要与别的控件重名)
②:叫醒你的控件,对,它就睡在Application.Current.Windows里!
注:该方法杀伤力巨大,有悖MVVM设计初衷,应尽量避开
                         foreach (Window win in Application.Current.Windows)
                        {
                            dataGrid = win.FindName("_vwMarkDatagrid"as DataGrid;
                            if (dataGrid != null && selectMark.MarkID != currentMarkID)
                            {
                                isFromMap = true;
                                currentMarkID = selectMark.MarkID;
                                dataGrid.SelectedItem = selectMark;
                                dataGrid.ScrollIntoView(selectMark);

                                break;
                            }
                        }
posted on 2015-06-19 12:24 Ying-er 阅读(1234) 评论(0)  编辑  收藏 所属分类: WPF

只有注册用户登录后才能发表评论。


网站导航: