根据其他控件的高度设置控件的最大高度(使用CalcBinding)

时间:2019-03-29 05:35:50

标签: wpf xaml element-binding

我有一个agens=# match (n) return n.value; value -------- "test" (1 row) 和三个TextBlock,分别包含在另一个Grid中。每个内部网格在第一行中包含Grid,在第二行中包含TextBlock。数据网格中的数据具有可变数量的记录。

DataGrid

我希望将每个内部网格的<Grid Name="gridOuter"> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="*" /> // <-- x3 ... </Grid.RowDefinitions> <TextBlock Grid.Row="0" Text="Contents" /> <Grid Grid.Row="1" Name="innerOne" MinHeight="50" MaxHeight="???"> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> <TextBlock Grid.Row="0">Heading One</TextBlock> <ScrollViewer Grid.Row="1"> <DataGrid Name="dataGridOne"> <DataGridColumns> <DataGridTextColumn Header="Title" Binding="{Title}" /> <DataGridTextColumn Header="Description" Binding="{Description}" /> <DataGridColumns> </DataGrid> </ScrollViewer> </Grid> ... <!-- x2 more with Grids named innerTwo and innerThree, with contained DataGrids named dataGridTwo and dataGridThree, respectively --> </Grid> 设置为等于外部网格的MaxHeight,减去其他两个内部网格的ActualHeight s之和。

我正在使用CalcBinding,但可以使用其他任何解决方案。

我希望我可以做类似的事情:

MinHeight

使用CalcBinding可以做到这一点吗?如果是,正确的语法是什么?如果没有,是否有其他可能的方法?

0 个答案:

没有答案