有的时候,我们需要遍历canvas中的一组控件,可以使用如下的办法
-----------------------------------------------------------------------------------------------------------------------
private void Canvas_MouseEnter(object sender, MouseEventArgs e)
{
foreach (Control c in this.Canvas1.Children)
{
Button b = c as Button;
if (b != null)
{
b.Content = "按钮";
}
}
}