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


C# DependencyObject.ToString方法代码示例

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


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

示例1: ShowVisualTree

 void ShowVisualTree(DependencyObject dObject)
 {
     sb.Append(dObject.ToString());
     sb.Append(Environment.NewLine);
     if (VisualTreeHelper.GetChildrenCount(dObject) > 0)
     {
         for (Int32 i = 0; i < VisualTreeHelper.GetChildrenCount(dObject); i++)
         {
             ShowVisualTree(VisualTreeHelper.GetChild(dObject, i));
         }
     }
 }
开发者ID:powernick,项目名称:CodeLib,代码行数:12,代码来源:MainWindow.xaml.cs

示例2: DumpTree

		void DumpTree (DependencyObject root, StringBuilder builder)
		{
			builder.AppendFormat (string.Format ("{0}", root.ToString()));
			if (VisualTreeHelper.GetChildrenCount (root) > 0) {
				builder.Append (" -> { \n");
				for (int i = 0; i < VisualTreeHelper.GetChildrenCount (root); i ++) {
					DumpTree (VisualTreeHelper.GetChild (root, i), builder);
					if (i < VisualTreeHelper.GetChildrenCount (root) - 1)
						builder.Append (",\n");
				}
				builder.Append (" }");
			}
		}
开发者ID:dfr0,项目名称:moon,代码行数:13,代码来源:Page.xaml.cs

示例3: SetSelectedItemStyle

        /// <summary>
        /// Sets the SelectedItemStyle property. This dependency property 
        /// indicates what style is to be used on a selected item.
        /// </summary>
        public static void SetSelectedItemStyle(DependencyObject d, Style value)
        {
            if (!(d is ListBox))
                throw new InvalidCastException(d.ToString() + " is no ListBox");

            var lb = (ListBox)d;

            if (GetSelectedItemStyle(d) == null)
                lb.SelectionChanged += new SelectionChangedEventHandler(lb_SelectionChanged);
            else if (value == null)
                lb.SelectionChanged -= new SelectionChangedEventHandler(lb_SelectionChanged);

            d.SetValue(SelectedItemStyleProperty, value);
        }
开发者ID:Hitchhikrr,项目名称:OpenStreetApp,代码行数:18,代码来源:ListBoxHelper.cs

示例4: ShowLogicTree

        void ShowLogicTree(DependencyObject dObject)
        {
            sb.Append(dObject.ToString());
            sb.Append(Environment.NewLine);
            foreach (Object d in LogicalTreeHelper.GetChildren(dObject))
            {
                if (d is DependencyObject)
                {
                    ShowLogicTree(d as DependencyObject);
                }
                else
                {
                    sb.Append(d.ToString());
                    sb.Append(Environment.NewLine);
                }

            }
        }
开发者ID:powernick,项目名称:CodeLib,代码行数:18,代码来源:MainWindow.xaml.cs

示例5: PropertyChangedCallback

 private static void PropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
 {
     dependencyObject.ToString();
 }
开发者ID:Dimamar,项目名称:quests,代码行数:4,代码来源:DiscretInputHorisontalControl.xaml.cs

示例6: GetParentWindow

 private Window GetParentWindow(DependencyObject o)
 {
     DependencyObject parent = VisualTreeHelper.GetParent(o);
     if (parent == null)
     {
         FrameworkElement fe = o as FrameworkElement;
         if (fe != null)
         {
             if (fe is Window)
             {
                 return fe as Window;
             }
             else if (fe.Parent != null)
             {
                 return GetParentWindow(fe.Parent);
             }
         }
         throw new ApplicationException("A window parent could not be found for " + o.ToString());
     }
     else
     {
         return GetParentWindow(parent);
     }
 }
开发者ID:shareefalis,项目名称:ace-windows-old,代码行数:24,代码来源:VATRPTranslucentWindow.cs

示例7: BuildBackLogicalTree

        void BuildBackLogicalTree(DependencyObject root)
        {

            if (root == null) return;
            Debug.Write(" - " + String.Format("[{0}]{1}", root.ToString(), (root is FrameworkElement) ? (root as FrameworkElement).Name : ""));

            var parent = LogicalTreeHelper.GetParent(root);

            BuildBackLogicalTree(parent as DependencyObject);
                
            
        }
开发者ID:rad1oactive,项目名称:BetterExplorer,代码行数:12,代码来源:TestWindow.xaml.cs

示例8: BuildLogicalTree

        void BuildLogicalTree(DependencyObject root, TreeViewItem item)
        {  

            TreeViewItem newItem = new TreeViewItem();
            newItem.Header = String.Format("[{0}]{1}", root.ToString(), (root is FrameworkElement)?(root as FrameworkElement).Name:"");
            newItem.Tag = root;
            if(item!=null)
            {
                item.Items.Add(newItem);
            }
            else
            {
                logicalTreeView.Items.Add(newItem);
            }
            var children = LogicalTreeHelper.GetChildren(root);
            foreach (var child in children)
            {
                if (child is DependencyObject)
                {
                    BuildLogicalTree(child as DependencyObject, newItem);
                }
            }
        }
开发者ID:rad1oactive,项目名称:BetterExplorer,代码行数:23,代码来源:TestWindow.xaml.cs

示例9: CheckLogicalTree

 void CheckLogicalTree(DependencyObject root)
 {
     var children = LogicalTreeHelper.GetChildren(root);
     foreach (var child in children)
     {
         if (child is DependencyObject)
         {
             if (LogicalTreeHelper.GetParent(child as DependencyObject) != root)
             {
                 Debug.WriteLine(string.Format("Incorrect logical parent in element - {0} in {1}", child.ToString(), root.ToString()));
             }
             CheckLogicalTree(child as DependencyObject);
         }
     }
 }
开发者ID:rad1oactive,项目名称:BetterExplorer,代码行数:15,代码来源:TestWindow.xaml.cs

示例10: CheckItem

        private static bool CheckItem(ItemCollection items, DependencyObject item)
        {
            // See http://www.codeproject.com/KB/menus/WPFMergeMenu.aspx?msg=3827921#xx3827921xx
            foreach (var piece in items)
            {
                string pstr = piece.ToString();
                string istr = item.ToString();
                if (pstr == istr)
                {
                    return true;
                }
            }

            return false;
        }
开发者ID:Jedzia,项目名称:BackBock,代码行数:15,代码来源:MergeMenus.cs


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