Esempio n. 1
0
 /// <summary>
 /// 选中
 /// </summary>
 /// <param name="model"></param>
 private void Select(MenuGroupModel model)
 {
     try
     {
         if (model.CurModel != null)
         {
             SelectMenuGroup = GetUserControl(model.CurModel.ToString());
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 初始化数据
 /// </summary>
 public MainViewModel()
 {
     try
     {
         for (int i = 0; i < 5; i++)
         {
             MenuGroupModel loader = new MenuGroupModel
             {
                 ID       = i,
                 MenuName = "洋葱Biu" + i,
             };
             BindingChildNode(loader);
             MenuGroupModels.Add(loader);
         }
     }
     catch (Exception ex)
     {
     }
 }
Esempio n. 3
0
 /// <summary>
 /// 绑定子节点  递归    通过父级ID 找到下层节点
 /// </summary>
 /// <param name="treeViewItem"></param>
 private static void BindingChildNode(MenuGroupModel treeViewItem)
 {
     try
     {
         for (int i = 1; i < 3; i++)
         {
             MenuGroupModel groupModel = new MenuGroupModel
             {
                 ID       = i + 10,
                 ParentId = treeViewItem.ID,
                 MenuName = "洋葱Biu" + i + 10,
                 CurModel = "WPF_TreeView.SelectView.UserControl" + i
             };
             treeViewItem.Nodes.Add(groupModel);
         }
     }
     catch (Exception ex)
     {
     }
 }