当前位置: 首页>>代码示例>>C#>>正文


C# FrameworkElement.SetValue方法代码示例

本文整理汇总了C#中System.Windows.FrameworkElement.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# FrameworkElement.SetValue方法的具体用法?C# FrameworkElement.SetValue怎么用?C# FrameworkElement.SetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.FrameworkElement的用法示例。


在下文中一共展示了FrameworkElement.SetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetCommonBindings

		protected override void SetCommonBindings(FrameworkElement marker)
		{
			base.SetCommonBindings(marker);

			marker.SetValue(ViewportPanel.YProperty, 0.0);
			marker.SetBinding(ViewportPanel.ViewportHeightProperty, DependentValueBinding);
			marker.SetBinding(ViewportPanel.ViewportWidthProperty, ColumnWidthBinding);
			marker.SetValue(ViewportPanel.ViewportVerticalAlignmentProperty, VerticalAlignment.Bottom);
			marker.SetBinding(ViewportPanel.XProperty, IndexBinding);
		}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:10,代码来源:ColumnChart.cs

示例2: Enemy

        public Enemy(Field field, FrameworkElement ui)
            : base(ui)
        {
            this.field = field;

            this.right = -ui.ActualWidth;
            this.bottom = (double)App.Random.Next(100);
            ui.SetValue(Canvas.RightProperty, this.right);
            ui.SetValue(Canvas.BottomProperty, this.bottom);
        }
开发者ID:azyobuzin,项目名称:MamoruYatsu,代码行数:10,代码来源:Enemy.cs

示例3: AddCommonBindings

		protected override void AddCommonBindings(FrameworkElement marker)
		{
			base.AddCommonBindings(marker);

			marker.SetValue(ViewportPanel.XProperty, 0.0);
			marker.SetBinding(ViewportPanel.ViewportWidthProperty, viewportWidthBinding);
			marker.SetValue(ViewportPanel.ViewportHeightProperty, 0.85);
			marker.SetValue(ViewportPanel.ViewportHorizontalAlignmentProperty, HorizontalAlignment.Left);
			marker.SetBinding(ViewportPanel.YProperty, viewportYBinding);
		}
开发者ID:modulexcite,项目名称:DynamicDataDisplay,代码行数:10,代码来源:HorizontalColumnChart.cs

示例4: FreezableBasicTest

        public void FreezableBasicTest()
        {
            int resourcesChangedCount = 0;
            object resourceValue;

            Freezable freezable = new Freezable();
            freezable.ResourcesChanged += (sender, e) => resourcesChangedCount++;

            FrameworkElement element = new FrameworkElement();
            element.DataContext = "data-context";
            element.Resources = new ResourceDictionary();
            element.Resources.Add("key1", "value1");

            Assert.AreNotEqual("data-context", freezable.GetValue(FrameworkElement.DataContextProperty));
            Assert.IsFalse(freezable.TryGetResource("key1", out resourceValue));

            element.SetValue(ValueProperty, freezable);
            Assert.AreEqual("data-context", freezable.GetValue(FrameworkElement.DataContextProperty));
            Assert.AreEqual(1, resourcesChangedCount);
            Assert.IsTrue(freezable.TryGetResource("key1", out resourceValue));
            Assert.AreEqual("value1", resourceValue);

            element.Resources.Add("key2", "value2");
            Assert.AreEqual(2, resourcesChangedCount);
            Assert.IsTrue(freezable.TryGetResource("key2", out resourceValue));
            Assert.AreEqual("value2", resourceValue);
        }
开发者ID:highzion,项目名称:Granular,代码行数:27,代码来源:FreezableTest.cs

示例5: SetupNextToolTip

		public static void SetupNextToolTip(FrameworkElement element, Window window) {
			element.ToolTip = GetNextToolTip(window);

			if (element.ToolTip != null) {
				element.SetValue(ToolTipService.ShowDurationProperty, 30000);
			}
		}
开发者ID:Tokeiburu,项目名称:RagnarokSDE,代码行数:7,代码来源:ToolTipsBuilder.cs

示例6: UpdateProperty

    internal void UpdateProperty( FrameworkElement element, DependencyProperty elementProp, DependencyProperty definitionProperty )
    {
      object currentValue = this.GetValue( definitionProperty );
      object localValue = this.ReadLocalValue( definitionProperty );
      object elementValue = element.GetValue( elementProp );
      bool areEquals = false;

      // Avoid setting values if it does not affect anything 
      // because setting a local value may prevent a style setter from being active.
      if( localValue != DependencyProperty.UnsetValue )
      {
        if( ( elementValue != null ) && ( currentValue != null ) )
        {
          areEquals = ( elementValue.GetType().IsValueType && currentValue.GetType().IsValueType )
                      ? elementValue.Equals( currentValue )  // Value Types
                      : currentValue == element.GetValue( elementProp ); // Reference Types
        }

        if( !areEquals )
        {
          element.SetValue( elementProp, currentValue );
        }
        else
        {
          element.ClearValue( elementProp );
        }
      }
    }
开发者ID:austinedeveloper,项目名称:WpfExtendedToolkit,代码行数:28,代码来源:EditorDefinitionBase.cs

示例7: SetPosition

        private static void SetPosition(FrameworkElement ellipse, double offset,
            double posOffSet, double step, double ew, double eh, double w, double h,
            double r)
        {
            double t = 2*Math.PI*posOffSet/10;
            ellipse.Width = ew;
            ellipse.Height = eh;

            ellipse.SetValue(Canvas.LeftProperty, w + r*Math.Cos(t));
            ellipse.SetValue(Canvas.TopProperty, h + r*Math.Sin(t));

            //ellipse.SetValue(Canvas.LeftProperty,w
            //    + Math.Sin(offset + posOffSet * step) * w);

            //ellipse.SetValue(Canvas.TopProperty, h
            //    + Math.Cos(offset + posOffSet * step) * h);
        }
开发者ID:0M3G4,项目名称:OCTGN,代码行数:17,代码来源:CircularProgressBar.xaml.cs

示例8: InjectControl

 public void InjectControl(FrameworkElement pControl)
 {
     _panel.Dispatcher.Invoke(() =>
     {
         pControl.SetValue(DockPanel.DockProperty, Dock.Left);
         _panel.Children.Insert(1, pControl);
     });
 }
开发者ID:madskristensen,项目名称:PackageInstaller,代码行数:8,代码来源:StatusBarInjector.cs

示例9: SetDefaultSource

 public static void SetDefaultSource(FrameworkElement image, string value)
 {
     if (image == null)
     {
         throw new ArgumentNullException("Image");
     }
     image.SetValue(ImageDecoder.DefaultSourceProperty, value);
 }
开发者ID:nick121212,项目名称:xima_desktop3,代码行数:8,代码来源:ImageDecoder.cs

示例10: SetHasBeenStyled

 private static void SetHasBeenStyled(FrameworkElement element, bool value)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     element.SetValue(HasBeenStyledProperty, value);
 }
开发者ID:kvervo,项目名称:HorizontalLoopingSelector,代码行数:8,代码来源:ImplicitStyleManager.cs

示例11: GetPushBindings

 public static PushBindingCollection GetPushBindings(FrameworkElement obj)
 {
     if (obj.GetValue(PushBindingsProperty) == null)
     {
         obj.SetValue(PushBindingsProperty, new PushBindingCollection(obj));
     }
     return (PushBindingCollection)obj.GetValue(PushBindingsProperty);
 }
开发者ID:vnl,项目名称:Monies,代码行数:8,代码来源:PushBindingManager.cs

示例12: SetIsConfigurable

 /// <summary>
 /// Sets the value of the IsConfigurable attached property to a specified FrameworkElement.
 /// </summary>
 /// <param name="element">The FrameworkElement to which the attached property is written.</param>
 /// <param name="value">The needed IsConfigurable value.</param>
 public static void SetIsConfigurable(FrameworkElement element, bool value)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     element.SetValue(IsConfigurableProperty, value);
 }
开发者ID:Esri,项目名称:arcgis-viewer-silverlight,代码行数:13,代码来源:ElementExtensions.cs

示例13: SetFill

 public static void SetFill(FrameworkElement element, bool value)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     element.SetValue(ZoomScrollViewer.FillProperty, value);
 }
开发者ID:ssickles,项目名称:archive,代码行数:8,代码来源:ZoomScrollViewer.cs

示例14: SetObserve

        public static void SetObserve(FrameworkElement frameworkElement, bool observe)
        {
            if (frameworkElement == null)
            {
                throw new ArgumentNullException("frameworkElement");
            }

            frameworkElement.SetValue(ObserveProperty, observe);
        }
开发者ID:VasiliBaranov,项目名称:navigation-assistant,代码行数:9,代码来源:SizeExtension.cs

示例15: SetObservedHeight

        public static void SetObservedHeight(FrameworkElement frameworkElement, double observedHeight)
        {
            if (frameworkElement == null)
            {
                throw new ArgumentNullException("frameworkElement");
            }

            frameworkElement.SetValue(ObservedHeightProperty, observedHeight);
        }
开发者ID:VasiliBaranov,项目名称:navigation-assistant,代码行数:9,代码来源:SizeExtension.cs


注:本文中的System.Windows.FrameworkElement.SetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。