在WPF网格中查找RowDefinition子级

时间:2019-11-25 19:00:54

标签: c# wpf rowdefinition

我正在使用WPF创建一个使用网格的C#应用​​程序。我有一些对象,当鼠标进入时,对象会发生变化。我还想影响包含该对象的其余行中包含的对象。这些对象以编程方式添加。我有什么办法可以找到鼠标输入的对象的RowDefinition吗?

这目前仅影响鼠标输入的对象

private void rect_MouseEnter(object sender, MouseEventArgs e)
{
     (sender as Rectangle).Fill = Brushes.Gray;
     int rowIndex = Grid.GetRow(sender as Rectangle);
}

private void rect_MouseLeave(object sender, MouseEventArgs e)
{
     (sender as Rectangle).Fill = Brushes.Transparent;     
}

0 个答案:

没有答案
相关问题