У меня есть Сетка. Я бы установил высоту сетки данных равной высоте для scrollviewer, я попытался использовать Height = "{Binding RelativeSource = {RelativeSource Mode = FindAncestor, AncestorType = {x: Type Border}}, Path = ActualHeight}, но это не так, как ожидалось, помогите мне! спасибо
<UserControl x:Class="AlarmResultControl"
.....>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<StackPanel
...
<Button
Content="Load More..."
Click="LoadMore_Click"
FontSize="15px"
IsEnabled="{Binding Path=Alarms.IsShow,Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged}"
Margin="10">
</Button>
</StackPanel>
</StackPanel>
</Grid>
<!--ScrollChanged="ScrollResult_ScrollChanged"-->
<ScrollViewer VerticalScrollBarVisibility="Auto"
PreviewMouseWheel="GridResultAutoScroll_MouseWheel"
ScrollChanged="ScrollResult_ScrollChanged"
VerticalAlignment="Stretch"
x:Name="ScrollResult"
Grid.Row="1"
Height="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Border}}, Path=ActualHeight}">
<Grid>
<DataGrid
BorderThickness="0,2,0,0"
BorderBrush="Gray"
Name="gridAlarmResult"
ItemsSource="{Binding Path=Alarms.SearchResult, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
SelectedItem="{Binding Path=Alarms.AlarmResultItemSelected, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
AutoGenerateColumns="False"
SelectionChanged="GridAlarmResult_SelectionChanged"
IsReadOnly="True"
CanUserAddRows="False"
CanUserDeleteRows="False"
Margin="5,0,5,40"
SelectionMode="Single"
Width="Auto"
SelectionUnit="FullRow"
RowStyle="{StaticResource rowStyle}"
ScrollViewer.CanContentScroll="True"
ScrollViewer.IsDeferredScrollingEnabled="True"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Disabled">
......
</DataGrid>
</Grid>
</ScrollViewer>
но фактический результат ![enter image description here](https://i.stack.imgur.com/igYRS.png)
Я буду scrollvier высоты = высота сетки данных ![enter image description here](https://i.stack.imgur.com/igYRS.png)