0

我在表单加载时隐藏的网格中有一个 DataGrid,并且想要将数据网格的宽度绑定到它的父节点,但它似乎没有绑定,这是示例:

<Grid  Visibility="Binding....}">
    <DataGrid MaxWidth="{Binding ActualWidth, RelativeSource={RelativeSource  Mode=FindAncestor, AncestorType=Grid  }}"
  .../>
 .
 .
 </Grid>

这里有什么问题?

4

1 回答 1

0

像这样试试

AncestorType={x:Type Grid}

代替

AncestorType=Grid

我希望这将有所帮助。

于 2012-07-30T06:51:40.100 回答