Пример #1
0
        public static void SetItemsDoubleClick(ItemsControl element, bool value)
        {
            element.SetValue(ItemsDoubleClickProperty, value);

            if (value)
            {
                element.PreviewMouseDoubleClick += new MouseButtonEventHandler(element_PreviewMouseDoubleClick);
            }
        }
        // Token: 0x060057EE RID: 22510 RVA: 0x00185A70 File Offset: 0x00183C70
        internal static TextSearch EnsureInstance(ItemsControl itemsControl)
        {
            TextSearch textSearch = (TextSearch)itemsControl.GetValue(TextSearch.TextSearchInstanceProperty);

            if (textSearch == null)
            {
                textSearch = new TextSearch(itemsControl);
                itemsControl.SetValue(TextSearch.TextSearchInstancePropertyKey, textSearch);
            }
            return(textSearch);
        }
Пример #3
0
        /// <summary>
        ///     Get the instance of TextSearch attached to the given ItemsControl or make one and attach it if it's not.
        /// </summary>
        /// <param name="itemsControl"></param>
        /// <returns></returns>
        internal static TextSearch EnsureInstance(ItemsControl itemsControl)
        {
            TextSearch instance = (TextSearch)itemsControl.GetValue(TextSearchInstanceProperty);

            if (instance == null)
            {
                instance = new TextSearch(itemsControl);
                itemsControl.SetValue(TextSearchInstancePropertyKey, instance);
            }

            return(instance);
        }
Пример #4
0
        /// <summary> 
        ///     Get the instance of TextSearch attached to the given ItemsControl or make one and attach it if it's not.
        /// </summary> 
        /// <param name="itemsControl"></param> 
        /// <returns></returns>
        internal static TextSearch EnsureInstance(ItemsControl itemsControl) 
        {
            TextSearch instance = (TextSearch)itemsControl.GetValue(TextSearchInstanceProperty);

            if (instance == null) 
            {
                instance = new TextSearch(itemsControl); 
                itemsControl.SetValue(TextSearchInstancePropertyKey, instance); 
            }
 
            return instance;
        }
Пример #5
0
 public static void SetEnum(ItemsControl control, Type t)
 {
     if (control != null)
         {
             control.SetValue(EnumProperty, t);
         }
 }
Пример #6
0
 /// <summary>
 /// Sets the group styles.
 /// </summary>
 /// <param name="itemsControl">The items control.</param>
 /// <param name="value">The value.</param>
 public static void SetGroupStyles(ItemsControl itemsControl, GroupStyleCollection value)
 {
     itemsControl.SetValue(GroupStylesProperty, value);
 }
 public static void SetItemContainersGeneratedCommand(ItemsControl ItemsControl, ICommand Value)
 {
     ItemsControl.SetValue(ItemContainersGeneratedCommandProperty, Value);
 }
 public static void SetAutoUniformWidth(ItemsControl obj, bool value)
 {
     obj.SetValue(UseAutoUniformWidthProperty, value);
 }
 public static void SetItemContainersGeneratedCommandParameter(ItemsControl ItemsControl, object Value)
 {
     ItemsControl.SetValue(ItemContainersGeneratedCommandParameterProperty, Value);
 }
Пример #10
0
    private static void CreateDragAdorner(DropInfo dropInfo)
    {
      var template = GetDragAdornerTemplate(m_DragInfo.VisualSource);
      var templateSelector = GetDragAdornerTemplateSelector(m_DragInfo.VisualSource);

      UIElement adornment = null;

      var useDefaultDragAdorner = GetUseDefaultDragAdorner(m_DragInfo.VisualSource);
      var useVisualSourceItemSizeForDragAdorner = GetUseVisualSourceItemSizeForDragAdorner(m_DragInfo.VisualSource);

      if (template == null && templateSelector == null && useDefaultDragAdorner) {
        var bs = CaptureScreen(m_DragInfo.VisualSourceItem, m_DragInfo.VisualSourceFlowDirection);
        if (bs != null) {
          var factory = new FrameworkElementFactory(typeof(Image));
          factory.SetValue(Image.SourceProperty, bs);
          factory.SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Aliased);
          factory.SetValue(RenderOptions.BitmapScalingModeProperty, BitmapScalingMode.HighQuality);
          factory.SetValue(FrameworkElement.WidthProperty, bs.Width);
          factory.SetValue(FrameworkElement.HeightProperty, bs.Height);
          factory.SetValue(FrameworkElement.HorizontalAlignmentProperty, HorizontalAlignment.Left);
          factory.SetValue(FrameworkElement.VerticalAlignmentProperty, VerticalAlignment.Top);
          template = new DataTemplate { VisualTree = factory };
        }
      }

      if (template != null || templateSelector != null) {
        if (m_DragInfo.Data is IEnumerable && !(m_DragInfo.Data is string)) {
          if (!useDefaultDragAdorner && ((IEnumerable)m_DragInfo.Data).Cast<object>().Count() <= 10) {
            var itemsControl = new ItemsControl();
            itemsControl.ItemsSource = (IEnumerable)m_DragInfo.Data;
            itemsControl.ItemTemplate = template;
            itemsControl.ItemTemplateSelector = templateSelector;

            if (useVisualSourceItemSizeForDragAdorner)
            {
              var bounds = VisualTreeHelper.GetDescendantBounds(m_DragInfo.VisualSourceItem);
              itemsControl.SetValue(FrameworkElement.MinWidthProperty, bounds.Width);
            }

            // The ItemsControl doesn't display unless we create a grid to contain it.
            // Not quite sure why we need this...
            var grid = new Grid();
            grid.Children.Add(itemsControl);
            adornment = grid;
          }
        } else {
          var contentPresenter = new ContentPresenter();
          contentPresenter.Content = m_DragInfo.Data;
          contentPresenter.ContentTemplate = template;
          contentPresenter.ContentTemplateSelector = templateSelector;

          if (useVisualSourceItemSizeForDragAdorner)
          {
            var bounds = VisualTreeHelper.GetDescendantBounds(m_DragInfo.VisualSourceItem);
            contentPresenter.SetValue(FrameworkElement.MinWidthProperty, bounds.Width);
            contentPresenter.SetValue(FrameworkElement.MinHeightProperty, bounds.Height);
          }

          adornment = contentPresenter;
        }
      }

      if (adornment != null) {
        if (useDefaultDragAdorner) {
          adornment.Opacity = GetDefaultDragAdornerOpacity(m_DragInfo.VisualSource);
        }

        var rootElement = RootElementFinder.FindRoot(dropInfo.VisualTarget ?? m_DragInfo.VisualSource);
        DragAdorner = new DragAdorner(rootElement, adornment);
      }
    }
 public static void SetScrollToNewItemFocusSpecificElementName(ItemsControl ItemsControl, string Value)
 {
     ItemsControl.SetValue(ScrollToNewItemFocusSpecificElementNameProperty, Value);
 }
Пример #12
0
 internal DropBehavior(ItemsControl element)
 {
     _element = element;
     _element.SetValue(BehaviorProperty,this);
     RegisterEvent();
 }
Пример #13
0
 public static void SetCurrentlyInView(ItemsControl control, object value)
 {
     control.SetValue(CurrentlyInViewProperty, value);
 }
Пример #14
0
 /// <summary>
 /// Sets the duration of the animation.
 /// </summary>
 /// <param name="itemsControl">The items control.</param>
 /// <param name="value">The value.</param>
 public static void SetAnimationDuration(ItemsControl itemsControl, TimeSpan value)
 {
     itemsControl.SetValue(AnimationDurationProperty, value);
 }
 private static void SetScrollToNewItemWeakEventListener(ItemsControl Element, IWeakEventListener Value)
 {
     Element.SetValue(ScrollToNewItemWeakEventListenerProperty, Value);
 }
 private static void SetItemContainersGeneratedCommandWeakEventListener(ItemsControl Element, IWeakEventListener Value)
 {
     Element.SetValue(ItemContainersGeneratedCommandWeakEventListenerProperty, Value);
 }
 private static void SetItemsControlManager(ItemsControl itemsControl, ItemsControlManager value)
 {
     itemsControl.SetValue(ItemsControlManagerProperty, value);
 }
Пример #18
0
        private static ItemsControlDropCommandBehavior GetOrCreateItemsControlDropBehavior(ItemsControl itemsControl)
        {
            var behavior = itemsControl.GetValue(ItemsControlDropCommandBehaviorProperty) as ItemsControlDropCommandBehavior;
            if (behavior == null)
            {
                behavior = new ItemsControlDropCommandBehavior(itemsControl);
                itemsControl.SetValue(ItemsControlDropCommandBehaviorProperty, behavior);
            }

            return behavior;
        }
Пример #19
0
 public static void SetRowCount(ItemsControl itemsControl, int rowCount)
 {
     itemsControl.SetValue(RowCountProperty, rowCount);
 }
 public static void SetScrollToNewItem(ItemsControl ItemsControl, bool Value)
 {
     ItemsControl.SetValue(ScrollToNewItemProperty, Value);
 }
Пример #21
0
 public static void SetShowGridLines(ItemsControl obj, bool value)
 {
     obj.SetValue(ShowGridLinesProperty, value);
 }
Пример #22
0
 private static StateObject GetOrCreateStateObject(ItemsControl itemsControl)
 {
     var stateObject = (StateObject)itemsControl.GetValue(StateObjectProperty);
     if(stateObject == null){
         stateObject = new StateObject(itemsControl);
         itemsControl.SetValue(StateObjectProperty, stateObject);
     }
     return stateObject;
 }
Пример #23
0
 public static void SetHasViews(ItemsControl element, bool value)
 {
     element.SetValue(HasViewsProperty, value);
 }
Пример #24
0
 public static void SetColumnCount(ItemsControl obj, int value)
 {
     obj.SetValue(ColumnCountProperty, value);
 }
Пример #25
0
        public void RegionGetsRemovedFromRegionManagerWhenRemovedFromScope()
        {
            var mappings = new RegionAdapterMappings();
            mappings.RegisterMapping(typeof(DependencyObject), new MockRegionAdapter());

            RegionManager regionManager = new RegionManager(mappings);
            var regionScopeControl = new ContentControl();
            RegionManager.SetRegionManager(regionScopeControl, regionManager);
            var control = new ItemsControl();
            control.SetValue(RegionManager.RegionNameProperty, "TestRegion");
            regionScopeControl.Content = control;
            Assert.IsTrue(regionManager.Regions.ContainsKey("TestRegion"));

            regionScopeControl.Content = null;

            Assert.IsFalse(regionManager.Regions.ContainsKey("TestRegion"));
        }
Пример #26
0
 public static void SetColumnDefinitionsSource(ItemsControl obj, IEnumerable<ColumnDefinition> value)
 {
     obj.SetValue(ColumnDefinitionsSourceProperty, value);
 }
Пример #27
0
 public static void SetIsEnabled(ItemsControl d, bool value)
 {
     d.SetValue(IsEnabledProperty, value);
 }
		public static void SetContent( ItemsControl owner, Object value )
		{
			owner.SetValue( ContentProperty, value );
		}