示例#1
0
        private static SingleViewBehavior GetOrCreateBehavior(ContentControl control)
        {
            SingleViewBehavior behavior = control.GetValue(SingleViewBehaviorProperty) as SingleViewBehavior;
            if (behavior == null)
            {
                behavior = new SingleViewBehavior(control);
                control.SetValue(SingleViewBehaviorProperty, behavior);
            }

            return behavior;
        }
示例#2
0
 internal static Object Eval(Object source, String pathExpression)
 {   
     Binding binding = new Binding(pathExpression) { Source = source };
     ContentControl dependencyObject = new ContentControl();
     BindingOperations.SetBinding(dependencyObject, DummyProperty, binding);
     return dependencyObject.GetValue(DummyProperty);
 }
示例#3
0
 public static string GetViewType(ContentControl control)
 {
     return control.GetValue(ViewTypeProperty) as string;
 }
        public void AddViewPassesDiferentScopeWhenAdding()
        {
            var regionManager = new MockRegionManager();
            IRegion region = new Region();
            region.RegionManager = regionManager;
            var myView = new ContentControl();

            region.Add(myView, "MyView", true);

            Assert.AreNotSame(regionManager, myView.GetValue(RegionManager.RegionManagerProperty));
        }
示例#5
0
 public static ModuleInfo GetModuleInfo(ContentControl control)
 {
     return control.GetValue(ModuleInfoProperty) as ModuleInfo;
 }
 public static ResourceUri GetSharedResources(ContentControl element)
 {
     return (ResourceUri)element.GetValue(SharedResourcesProperty);
 }
        public void AddViewPassesSameScopeByDefaultToNamedView()
        {
            var regionManager = new MockRegionManager();
            IRegion region = new Region();
            region.RegionManager = regionManager;
            var myView = new ContentControl();

            region.Add(myView, "MyView");

            Assert.AreSame(regionManager, myView.GetValue(RegionManager.RegionManagerProperty));
        }
示例#8
0
 private bool IsNewItem(ContentControl child)
 {
     return (bool)child.GetValue(IsNewProperty);
 }
        public bool DetectCollision(ContentControl controlOne, ContentControl controlTwo)
        {
            // new Rect(X1, Y1, X2, Y2);
            Rect c1Rect = new Rect(
                new Point(Convert.ToDouble(controlOne.GetValue(Canvas.LeftProperty)),
                           Convert.ToDouble(controlOne.GetValue(Canvas.TopProperty))
                           ),
                new Point(Convert.ToDouble(controlOne.GetValue(Canvas.LeftProperty)) + controlOne.ActualWidth,
                           Convert.ToDouble(controlOne.GetValue(Canvas.TopProperty)) + controlOne.ActualHeight
                           )
                           );

            Rect c2Rect = new Rect(
                new Point(Convert.ToDouble(controlTwo.GetValue(Canvas.LeftProperty)),
                           Convert.ToDouble(controlTwo.GetValue(Canvas.TopProperty))
                           ),
                new Point(Convert.ToDouble(controlTwo.GetValue(Canvas.LeftProperty)) + controlTwo.ActualWidth,
                           Convert.ToDouble(controlTwo.GetValue(Canvas.TopProperty)) + controlTwo.ActualHeight
                           )
                           );

            c1Rect.Intersect(c2Rect);

            return !(c1Rect == Rect.Empty);
        }
示例#10
0
 public static bool GetOnSelectedTabChanged(ContentControl element)
 {
     return (bool)element.GetValue(OnDataContextChangedProperty);
 }
 public static Storyboard GetContentChangedAnimation(ContentControl element)
 {
     return (Storyboard)element.GetValue(ContentChangedAnimationProperty);
 }
示例#12
0
 public static bool GetIsActive(this System.Windows.Controls.ContentControl control)
 {
     return((bool)control.GetValue(IsActiveProperty));
 }