Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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;
        }
Esempio n. 5
0
 public static void SetEnum(ItemsControl control, Type t)
 {
     if (control != null)
         {
             control.SetValue(EnumProperty, t);
         }
 }
 /// <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);
 }
Esempio n. 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);
 }
Esempio n. 12
0
 internal DropBehavior(ItemsControl element)
 {
     _element = element;
     _element.SetValue(BehaviorProperty,this);
     RegisterEvent();
 }
Esempio n. 13
0
 public static void SetCurrentlyInView(ItemsControl control, object value)
 {
     control.SetValue(CurrentlyInViewProperty, value);
 }
 /// <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);
 }
Esempio n. 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;
        }
Esempio n. 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);
 }
Esempio n. 21
0
 public static void SetShowGridLines(ItemsControl obj, bool value)
 {
     obj.SetValue(ShowGridLinesProperty, value);
 }
Esempio n. 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;
 }
Esempio n. 23
0
 public static void SetHasViews(ItemsControl element, bool value)
 {
     element.SetValue(HasViewsProperty, value);
 }
Esempio n. 24
0
 public static void SetColumnCount(ItemsControl obj, int value)
 {
     obj.SetValue(ColumnCountProperty, value);
 }
Esempio n. 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"));
        }
Esempio n. 26
0
 public static void SetColumnDefinitionsSource(ItemsControl obj, IEnumerable<ColumnDefinition> value)
 {
     obj.SetValue(ColumnDefinitionsSourceProperty, value);
 }
Esempio n. 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 );
		}