Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何将网格中元素的高度绑定到网格的实际高度。行_C#_Xaml_Windows 8.1 Universal - Fatal编程技术网

C# 如何将网格中元素的高度绑定到网格的实际高度。行

C# 如何将网格中元素的高度绑定到网格的实际高度。行,c#,xaml,windows-8.1-universal,C#,Xaml,Windows 8.1 Universal,我有一个Windows 8.1通用应用程序,我正在为客户端工作。客户希望弹出按钮的一部分与同一弹出按钮的不同部分具有相同的高度。弹出型按钮使用一个datatemplate,该datatemplate包含一个三行两列的网格。scrollviewer第0行第1列(第3行)中的元素需要与网格中第一行的高度相同。有没有办法做到这一点 我无法获取x:Name的网格,因为它位于datatemplate中。 客户端坚持红色箭头指示的区域与弹出按钮顶部的橙色区域高度相同,并且必须位于该可滚动区域中 有什么想法

我有一个Windows 8.1通用应用程序,我正在为客户端工作。客户希望弹出按钮的一部分与同一弹出按钮的不同部分具有相同的高度。弹出型按钮使用一个datatemplate,该datatemplate包含一个三行两列的网格。scrollviewer第0行第1列(第3行)中的元素需要与网格中第一行的高度相同。有没有办法做到这一点

我无法获取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>

试试这个:

<RowDefinition x:Name="row">
<Button Height="{Binding Height,ElementName="row"}">

附加XAML代码。