我有一个Windows 8.1通用应用程序,我正在为客户端工作。客户希望弹出窗口的一部分与同一弹出窗口的不同部分的高度相同。弹出窗口使用datatemplate,该datatemplate包含三行和两列的网格。第0行第1列(行范围3)中的scrollviewer中的元素需要与网格中第一行的高度相同。有没有办法实现这个目标?
我无法使用x:Name获取网格,因为它位于datatemplate中。 客户坚持认为红色箭头指示的区域与弹出窗口顶部的橙色区域的高度相同,并且必须位于该可滚动区域内。
有什么想法吗?
谢谢,
扎克
编辑:这是xaml。
<DataTemplate x:Name="MultiselectFlyout">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="White">
<Grid.RowDefinitions>
<RowDefinition Height=".25*" />
<RowDefinition Height=".18*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width=".22*" />
</Grid.ColumnDefinitions>
<Border Background="Gray" Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<TextBlock Text="{Binding SelectedName, Mode=OneWay}" FontSize="34" FontFamily="{StaticResource GothamMedium}" TextAlignment="Center" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<Border Grid.Row="1" Grid.ColumnSpan="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="Transparent">
<Image Source="../Assets/dropshadow_B.png" Height="150" Margin="0,-110,0,0" Opacity=".3" Stretch="Fill" VerticalAlignment="Top" HorizontalAlignment="Stretch"/>
</Border>
<Border Background="{StaticResource PrimaryColor}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<TextBlock Foreground="White" Padding="0" TextAlignment="Center" VerticalAlignment="Center">
<Run Text="{Binding Title}" FontSize="44" FontFamily="{StaticResource GothamMedium}"/>
<LineBreak/>
<Run Text="{Binding Subtitle[0]}" FontSize="28" FontFamily="{StaticResource GothamLight}"/>
</TextBlock>
</Border>
<Grid x:Name="ImageSwap" Grid.Row="2" Background="White">
<Border Background="Transparent" BorderBrush="Gray" BorderThickness="0,0,1,0">
<Image Source="{Binding BottomImage, Mode=OneWay}" Stretch="Uniform" ImageOpened="Image_Opened"/>
</Border>
<Border Background="Transparent" BorderBrush="Gray" BorderThickness="0,0,1,0">
<Image Source="{Binding TopImage, Mode=OneWay}" Opacity="{Binding TopImgVisibility, Mode=OneWay}" Stretch="Uniform" ImageOpened="Image_Opened"/>
</Border>
</Grid>
<ScrollViewer Grid.Row="1" Grid.RowSpan="2" Grid.Column="1" Background="White" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" VerticalScrollBarVisibility="Hidden" VerticalScrollMode="Enabled" Loaded="ScrollViewer_Loaded" Tapped="ScrollViewer_Tapped">
<ItemsControl ItemsSource="{Binding Colors, Mode=OneWay}" ItemTemplateSelector="{StaticResource DividerOrImageSelector}" Background="White" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical" HorizontalAlignment="Stretch" VerticalAlignment="Top"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</ScrollViewer>
<Border Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="LightGray">
<Viewbox StretchDirection="DownOnly" Margin="0">
<TextBlock FontFamily="{StaticResource GothamMedium}" Foreground="Black" FontSize="22" TextAlignment="Center" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Run Text="SCROLL"/><LineBreak /><Run Text="TO SEE ALL"/><LineBreak /><Run Text="THE COLORS"/>
</TextBlock>
</Viewbox>
</Border>
</Grid>
</DataTemplate>
答案 0 :(得分:0)
试试这个:
<RowDefinition x:Name="row">
<Button Height="{Binding Height,ElementName="row"}">