所以我试图让我的轴平面被绘制在 中ScrollViewer
,然后我想进入并在绘制轴的空间上绘制一个信号列表,以便信号在轴的顶部。我认为正确的做法是使用ZIndex
,但我一定做错了什么。
http://picpaste.com/signalgraph1-HSFHBYOG.JPG
基本上,它看起来像ScrollViewer
我想要的轴的大小,但是然后StackPanel
被放置在轴之后,而不是像我期望的那样被放置 75 个单位。
为什么会这样?我怎样才能得到我想要的行为?
<ScrollViewer
x:Name="signal_scrollviewer"
Focusable="False"
CanContentScroll="False">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="75" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<wpfExp:SignalGraphAxis Grid.ZIndex="1"
Grid.Row="0"
Grid.RowSpan="2"
x:Name="signal_axis"
Height="{Binding ElementName=signal_scrollviewer, Path=ActualHeight}"
signal_graph_window_width="{Binding RelativeSource = {RelativeSource AncestorType={x:Type ScrollViewer}}, Path=ActualWidth}"
GraphHeight ="{Binding ElementName=graph_viewer, Path=GraphHeight, Mode=OneWay}"
PenColor="{Binding ElementName=GraphColorPicker, Path=SelectedColor, Mode=OneWay}"
PenWidth="{Binding ElementName=graph_viewer, Path=GraphPenWidth, Mode=OneWay}"
X_Scale="{Binding ElementName=graph_viewer, Path=X_Scale, Mode=OneWay}"
MaxTimeValue="{Binding ElementName=graph_viewer, Path=_SignalDataViewModel.MaxTimeValue, Mode=OneWay}"
/>
<StackPanel Background="Transparent" Grid.ZIndex="2" Grid.Row="1">
<ItemsPresenter />
</StackPanel>
</Grid>
</ScrollViewer>