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


C# UserControl.FindName方法代码示例

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


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

示例1: showerror

 public void showerror(Hashtable errors,UserControl a)
 {
     foreach (DictionaryEntry error in errors)
     {
         String check = error.Key.ToString();
         if (error.Value.ToString() == "text")
         {
             if (check.Substring(check.Length - 1, 1) != "!" )
             {
                 TextBox e = (TextBox)a.FindName("txt" + check);
                 e.BorderBrush = Brushes.Red;
             }
             else
             {
                 TextBox e = (TextBox)a.FindName("txt"+check.Substring(0,check.Length-1));
                 e.BorderBrush = Brushes.SkyBlue;
             }
         }
         if (error.Value.ToString() == "password")
         {
             if (check.Substring(check.Length - 1, 1) != "!")
             {
                 PasswordBox e = (PasswordBox)a.FindName("pb" + error.Key);
                 e.BorderBrush = Brushes.Red;
             }
             else
             {
                 PasswordBox e = (PasswordBox)a.FindName("pb" + check.Substring(0, check.Length - 1));
                 e.ClearValue(TextBox.BorderBrushProperty);
                 e.Password = "";
             }
         }
         if (error.Value.ToString() == "duplicate")
         {
             TextBox e = (TextBox)a.FindName("txt" + check.Substring(0, check.Length - 1));
             e.BorderBrush = Brushes.Red;
         }
     }
 }
开发者ID:sumit10,项目名称:BMS,代码行数:39,代码来源:basemodel.cs

示例2: DragSourcePieMenuPreviewMouseLeftButtonDown

        public void DragSourcePieMenuPreviewMouseLeftButtonDown(UserControl diagramUserControl, StylusEventArgs e)
        {
            try
            {
                _topUserControl = diagramUserControl;

                _initialMousePosition = e.GetPosition(_topUserControl);

                _adornerLayer = (Canvas)_topUserControl.FindName("adornerLayer");

                _dropTarget = (UIElement)_topUserControl.FindName("inkCanvas");

            }
            catch (Exception exc)
            {
                Console.WriteLine("Exception in DragDropHelper: " + exc.InnerException.ToString());
            }
        }
开发者ID:buptkang,项目名称:LogicPad,代码行数:18,代码来源:DragDropHelper.cs

示例3: DragSource_UserControl_PreviewMouseLeftButtonDown

        public void DragSource_UserControl_PreviewMouseLeftButtonDown(UserControl diagramUserControl, object sender, MouseButtonEventArgs e)
        {
            try
            {
                _topUserControl = diagramUserControl;

                _initialMousePosition = e.GetPosition(_topUserControl);

                _adornerLayer = (Canvas)_topUserControl.FindName("adornerLayer");

                _dropTarget = (UIElement)_topUserControl.FindName("inkCanvas");

                _draggedData = (sender as FrameworkElement).DataContext;
            }
            catch (Exception exc)
            {
                Console.WriteLine("Exception in DragDropHelper: " + exc.InnerException.ToString());
            }
        }
开发者ID:buptkang,项目名称:LogicPad,代码行数:19,代码来源:DragDropHelper.cs

示例4: ReadSampleCount

 private int ReadSampleCount(UserControl ControlUI)
 {
     var container = ControlUI.FindName("txtSampleCnt");
     TextBox txtSampleCnt = (TextBox)container;
     if (txtSampleCnt == null)
         throw new Exception("无法找到样本数textbox!");
     if (txtSampleCnt.Text == "")
     {
         throw new Exception("请先设置样本数!");
     }
     int val = int.Parse(txtSampleCnt.Text);
     if (val <= 0)
     {
         throw new Exception("样本数必须大于0!");
     }
     return val;
 }
开发者ID:kingofcrabs,项目名称:TTForensic,代码行数:17,代码来源:CommandProcessor.cs


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