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


C# UIElement.GetType方法代码示例

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


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

示例1: IsSubClassOf

 private bool IsSubClassOf(UIElement ui, Type type)
 {
     while (null != ui)
     {
         if ((ui.GetType() == type) ||
             (ui.GetType().IsSubclassOf(type)))
         {
             return true;
         }
         ui = VisualTreeHelper.GetParent(ui) as UIElement;
     }
     return false;
 }
开发者ID:284247028,项目名称:MvvmCross,代码行数:13,代码来源:ManipulationHook.cs

示例2: AttachCore

 protected override void AttachCore(UIElement element)
 {
     if (description == null)
     {
         string str = element.GetType().Name;
         description = str;
     }
 }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:8,代码来源:StandardDescription.cs

示例3: InitializeView

        private void InitializeView(UIElement view) {
            var type = view.GetType();

            var initializeMethod = type.GetMethod("InitializeComponent", BindingFlags.Public | BindingFlags.Instance);

            if (initializeMethod == null)
                return;

            initializeMethod.Invoke(view, null);
        }
开发者ID:rho24,项目名称:Rholiver.Mvvm,代码行数:10,代码来源:ViewLocator.cs

示例4: AnimateColor

 public static void AnimateColor(SolidColorBrush from, SolidColorBrush to, UIElement control, double duration)
 {
     SolidColorBrush myBrush = new SolidColorBrush();
     myBrush = from;
     ColorAnimation myColorAnimation = new ColorAnimation();
     myColorAnimation.From = from.Color;
     myColorAnimation.To = to.Color;
     myColorAnimation.Duration = new Duration(TimeSpan.FromSeconds(duration));
     myBrush.BeginAnimation(SolidColorBrush.ColorProperty, myColorAnimation);
     control.GetType().GetProperty("Background").SetValue(control, myBrush);
 }
开发者ID:Sential,项目名称:WebExpress-beta,代码行数:11,代码来源:StaticFunctions.cs

示例5: CreateWrapperForUIElement

        internal static IEditable CreateWrapperForUIElement(CanvasEditor editor, UIElement element)
        {
            IEditable result = null;

            Assembly assembly = Assembly.GetAssembly(typeof(EditableWrapper));
            string name = element.GetType().Name;
            Type type = assembly.GetType(typeof(EditableWrapper).Namespace + ".Editable" + name);
            if (type != null)
            {
                result = (IEditable)Activator.CreateInstance(type, new object[] { editor, element });
            }

            return result;
        }
开发者ID:Kaftan777ski,项目名称:mapinect,代码行数:14,代码来源:EditableWrapper.cs

示例6: FindByName

		private void FindByName(UIElement element, List<WildcardPattern> patterns, ref List<UIElement> results)
		{
			foreach (string content in _contentProperties)
			{
				Type type = element.GetType();
				var prop = type.GetProperty(content);
				if (prop != null)
				{
					var enumerable = prop.GetValue(element, null) as System.Collections.IEnumerable;
					if (enumerable != null)
					{
						foreach (object el in enumerable)
						{
							var fel = el as FrameworkElement;
							if (fel != null)
							{
								foreach (var pattern in patterns)
								{
									if (pattern.IsMatch(fel.Name))
									{
										results.Add(fel);
									}
								}
							}
						}
						foreach (object el in enumerable)
						{
							if (el is UIElement)
							{
								FindByName((UIElement)el, patterns, ref results);
							}
						}
					}
					else
					{
						var el = prop.GetValue(element, null) as UIElement;
						if (el != null)
						{
							var fel = el as FrameworkElement;
							if (fel != null)
							{
								foreach (var pattern in patterns)
								{
									if (pattern.IsMatch(fel.Name))
									{
										results.Add(fel);
									}
								}
								FindByName(fel, patterns, ref results);
							}
							else
							{
								FindByName(el, patterns, ref results);
							}
						}
					}
				}
				// if we didn't find it by now, just give up...
			}
		}
开发者ID:ForNeVeR,项目名称:PoshConsole,代码行数:60,代码来源:UIElement-Select-Command.cs

示例7: RegisterEvent

 private void RegisterEvent(UIElement element, string triggerEvent)
 {
   var eventRef = element.GetType().GetEvent(triggerEvent);
   if (eventRef != null)
   {
     var invokeMethod = eventRef.EventHandlerType.GetMethod("Invoke");
     var parameters = invokeMethod.GetParameters();
     if (parameters.Length == 2)
     {
       if (typeof(RoutedEventArgs).IsAssignableFrom(parameters[1].ParameterType))
       {
         eventRef.AddEventHandler(element, new RoutedEventHandler(InvokeProvider));
       }
       else if (typeof(EventArgs).IsAssignableFrom(parameters[1].ParameterType))
       {
         eventRef.AddEventHandler(element, new EventHandler(InvokeProvider));
       }
     }
   }
 }
开发者ID:nschonni,项目名称:csla-svn,代码行数:20,代码来源:NavigatorProvider.cs

示例8: InvalidOperationException

        void IViewAware.AttachView(UIElement view)
        {
            if (this.View != null)
                throw new InvalidOperationException(String.Format("Tried to attach View {0} to ViewModel {1}, but it already has a view attached", view.GetType().Name, this.GetType().Name));

            this.View = view;

            this.logger.Info("Attaching view {0}", view);

            var viewAsFrameworkElement = view as FrameworkElement;
            if (viewAsFrameworkElement != null)
            {
                if (viewAsFrameworkElement.IsLoaded)
                    this.OnViewLoaded();
                else
                    viewAsFrameworkElement.Loaded += (o, e) => this.OnViewLoaded();
            }
        }
开发者ID:modulexcite,项目名称:Stylet,代码行数:18,代码来源:Screen.cs


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