Beispiel #1
0
 private static void OnCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     if (d is WinRTXamlToolkit.Controls.TreeView)
     {
         WinRTXamlToolkit.Controls.TreeView Trv = (WinRTXamlToolkit.Controls.TreeView)d;
         if (Trv == null)
         {
             return;
         }
         Trv.SelectedItemChanged += TreeView_SelectedItemChanged;
     }
     else if (d is TextBox)
     {
         TextBox txtBx = (TextBox)d;
         if (txtBx == null)
         {
             return;
         }
         txtBx.LostFocus        += txtBx_LostFocus;
         txtBx.SelectionChanged += TxtBox_SelectionChanged;
     }
     else
     {
         Selector s = d as Selector;
         if (s == null)
         {
             return;
         }
         s.SelectionChanged += s_SelectionChanged;
     }
 }
Beispiel #2
0
        static void TreeView_SelectedItemChanged(object sender, WinRTXamlToolkit.Controls.RoutedPropertyChangedEventArgs <object> e)
        {
            WinRTXamlToolkit.Controls.TreeView s = (WinRTXamlToolkit.Controls.TreeView)sender;
            ICommand cmd   = s.GetValue(SelectionChangedTrigger.CommandProperty) as ICommand;
            object   param = e.NewValue;

            if (cmd != null && cmd.CanExecute(param))
            {
                cmd.Execute(param);
            }
        }