Example #1
0
        private void tvModuleProcess_Checked(object sender, Telerik.Windows.RadRoutedEventArgs e)
        {
            bool isInitiallyChecked = (e as RadTreeViewCheckEventArgs).IsUserInitiated;

            if (isInitiallyChecked)//是用户手动选择(非自动Check)
            {
                RadTreeViewItem tvItem = e.OriginalSource as RadTreeViewItem;
                tvItem.ExpandAll();//ExpandAll之后选中项才会出现在CheckedItems中
            }
        }
        private void BuildTree(RadTreeViewItem treeview, int idChucNang)
        {
            RadTreeViewItem treeviewChild = null;

            foreach (Presentation.Process.ZAMainAppServiceRef.ChucNangDto chucnang in ClientInformation.ListChucNang.Where(f => f.IDChucNangCha.Equals(treeview.Tag)))
            {
                getMenu(chucnang.IDChucNang);
                treeviewChild        = new RadTreeViewItem();
                treeviewChild.Tag    = objMenu.ID;
                treeviewChild.Header = LLanguage.SearchResourceByKey(objMenu.MA_NNGU);
                treeviewChild.Uid    = objMenu.MA_MENU;
                treeview.Items.Add(treeviewChild);
                if (idChucNang == objMenu.ID)
                {
                    trvMenu.SelectedItem = treeviewChild;
                    parentItem.ExpandAll();
                }
                BuildTree(treeviewChild, idChucNang);
            }
        }