本文整理汇总了C#中System.Windows.Controls.Grid.FindName方法的典型用法代码示例。如果您正苦于以下问题:C# Grid.FindName方法的具体用法?C# Grid.FindName怎么用?C# Grid.FindName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.Grid
的用法示例。
在下文中一共展示了Grid.FindName方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NavigationViewController
public NavigationViewController(Window canvas, Grid navigationBar)
{
this.canvas = canvas;
this.canvasGrid = canvas.FindName("Canvas") as Grid;
this.navigationBar = navigationBar;
this.leftButton = (Label)navigationBar.FindName("LeftButtonLabel");
this.rightButton = (Label)navigationBar.FindName("RightButtonLabel");
this.title = (Label)navigationBar.FindName("Title");
((StackPanel)(navigationBar.FindName("LeftButton"))).MouseDown += leftButton_MouseDown;
((StackPanel)(navigationBar.FindName("RightButton"))).MouseDown += rightButton_MouseDown;
}
示例2: ShowProgressBar
public static void ShowProgressBar(DependencyObject DO, Grid LayoutRoot)
{
myCanvas = LayoutRoot.FindName("modal") as Canvas;
myProgressIndicator = SystemTray.GetProgressIndicator(DO);
myCanvas.Visibility = Visibility.Visible;
myProgressIndicator.IsVisible = true;
}
示例3: AddVersionLabel
/// <summary>
/// 1. 显示产品名和版本号
/// </summary>
/// <param name="layoutRoot">page上用于布局控件的容器</param>
public override void AddVersionLabel(Grid layoutRoot)
{
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
string version = XSystemConfiguration.GetInstance().XFaceVersion + " " + XSystemConfiguration.GetInstance().BuildNumber;
string product = XDocument.Load("WMAppManifest.xml").Root.Element("App").Attribute("Title").Value;
XSplashScreenControl splash = layoutRoot.FindName("splash") as XSplashScreenControl;
splash.SetDisplayInfo("version: " + version, "Product: " + product);
});
}
示例4: FindChildElementByNameOrType
private static UIElement FindChildElementByNameOrType(Grid parent, string childName, Type childType)
{
UIElement element = parent.FindName(childName) as UIElement;
if (element != null)
{
return element;
}
else
{
foreach (UIElement child in parent.Children)
{
if (childType.IsInstanceOfType(child))
{
return child;
}
}
return null;
}
}
示例5: FindChildren
public void FindChildren ()
{
Grid grid = new Grid ();
grid.Children.Add (new UserControl { Name = "a" });
TestPanel.Children.Add (grid);
Assert.IsNotNull (grid.FindName ("a"), "#1");
}
示例6: programNameViewMode
private void programNameViewMode(Grid parentGrid)
{
//切换到查看方案名的模式.
TextBlock programNameTextBlock = parentGrid.FindName("ProgramNameTextBlock") as TextBlock;
Grid programNameGrid = parentGrid.FindName("ProgramNameGrid") as Grid;
TextBox programNameTextBox = programNameGrid.FindName("ProgramNameTextBox") as TextBox;
string name = programNameTextBox.Text;
programNameTextBlock.Visibility = System.Windows.Visibility.Visible;
programNameGrid.Visibility = System.Windows.Visibility.Collapsed;
StackPanel stackPanel = parentGrid.Parent as StackPanel;
TextBlock programIDTextBlock = stackPanel.FindName("ProgramIDTextBlock") as TextBlock;
int programID = Int32.Parse(programIDTextBlock.Text);
foreach (Program program in programList)
{
if (program.id == programID)
{
program.name = name;
program.update();
break;
}
}
}
示例7: UpdateHelper
public UpdateHelper(Grid grid, DispatcherTimer timer)
: this()
{
_grid = grid;
_progressBar = grid.FindName("proBar") as ProgressBar;
_tbProgressInfo = grid.FindName("tbProcess") as TextBlock;
_progressBar.Maximum = _fileNum;
_timer = timer;
_fileBackupList = new List<Tuple<string, string>>();
}
示例8: GetControl
private object GetControl(Grid parent, string controlName)
{
if (parent != null)
{
return parent.FindName(controlName);
}
return null;
}
示例9: UpdateBinding
private BindingExpression UpdateBinding(String controlName, Grid sender, DependencyProperty dp)
{
BindingExpression expression = ((TextBox)(sender.FindName(controlName))).GetBindingExpression(dp);
expression.UpdateSource();
return expression;
}
示例10: Grid_Tap
private void Grid_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
try
{
if (grid != null)
{
TextBlock tb1 = (TextBlock)grid.FindName("tbSongTitle");
tb1.Foreground = new SolidColorBrush(Colors.White);
}
grid = (Grid)sender;
TextBlock tb = (TextBlock)grid.FindName("tbSongTitle");
tb.Foreground = myAnimatedBrush;
myStoryboard.Begin();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
示例11: ShowModalCanvas
public static void ShowModalCanvas(Grid LayoutRoot)
{
myCanvas = LayoutRoot.FindName("modal") as Canvas;
myCanvas.Visibility = Visibility.Visible;
}