示例#1
0
 /// <summary>
 /// Обновить панель команд.
 /// </summary>
 /// <param name="bar">Новая панель.</param>
 private void UpdateOneCommandBar(BaseOneCommandBar bar)
 {
     try
     {
         CommandBarPanel.Children.Clear();
         if (bar == null || !GetCommandBarIsVisible(this.Content as DependencyObject))
         {
             return;
         }
         var content = Content as FrameworkElement;
         var binding = new Binding()
         {
             Mode = BindingMode.TwoWay, Path = new PropertyPath("DataContext"), Source = content
         };
         bar.SetBinding(FrameworkElement.DataContextProperty, binding);
         CommandBarPanel.Children.Add(bar);
     }
     catch (Exception)
     {
     }
 }
示例#2
0
 public static void SetCommandBar(DependencyObject obj, BaseOneCommandBar value)
 {
     obj.SetValue(CommandBarProperty, value);
 }