在WEH8.1上扩展gridview中的选定行

时间:2016-09-06 16:19:13

标签: c# wpf gridview windows-phone-8.1 windows-embedded-8.1

我目前正在开发Windows Embedded Handheld 8.1的应用程序,并遇到了一个问题,我在gridview中有一个动态扩展的网格。我的问题是,由于此应用程序在手持设备上运行,因此每行使用的空间非常有限。

我想要做的是只显示每行的一般信息,然后在设备中点击或选择一行时,我想以某种方式扩展该特定行并显示一些更详细的信息,这似乎是但问题是,因为一旦我开始弄乱特定的行高度,ItemTemplate中的每一行自然也会增长,在网格中留下很多空格。

通常我会使用DataGrid和DataGrid.RowDetailsTemplate,但是这个控件似乎没有在WEH8.1中实现。

所以我的问题是,如果某人有解决方案或可能解决我的问题吗?

GridView下面的代码示例:

    <ScrollViewer Grid.Row="1" Margin="0">

        <GridView x:Name="gvCustomerOrderRows">
            <GridView.ItemTemplate>
                <DataTemplate>
                    <Grid Background="{Binding BackgroundColor}" Margin="0" Height="{Binding ShowSecondRowHeight}"  Tapped="Grid_Tapped"  Tag="{Binding kor_row}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="50"/>
                            <RowDefinition Height="20"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="20"/>
                            <ColumnDefinition Width="31.25"/>
                            <ColumnDefinition Width="58.75"/>
                            <ColumnDefinition Width="105"/>
                            <ColumnDefinition Width="65"/>
                            <ColumnDefinition Width="50"/>
                            <ColumnDefinition Width="70"/>
                        </Grid.ColumnDefinitions>

                        <TextBlock Text="{Binding kor_pos}" Grid.Row="0" Visibility="{Binding VisibilityHideThenText}" Grid.Column="0" FontSize="14" VerticalAlignment="Center" Margin="0,17,0,16"></TextBlock>
                        <TextBlock Text="{Binding kor_partno}" Grid.Row="0" Visibility="{Binding VisibilityHideThenText}" Grid.Column="1" FontSize="14" VerticalAlignment="Center" Margin="0,17,0,16"  Grid.ColumnSpan="2" ></TextBlock>
                        <TextBlock Text="{Binding kor_txt}" Grid.Row="0" Grid.Column="3" Grid.ColumnSpan="2" FontSize="14" VerticalAlignment="Center" MaxLines="2" TextWrapping="Wrap"/>
                        <TextBlock Text="{Binding kor_rqty}" Grid.Row="0" Visibility="{Binding VisibilityHideThenText}" Grid.Column="5" FontSize="14" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold" TextAlignment="Center"></TextBlock>
                        <TextBox x:Name="txtQuantity" Grid.Row="0" Text="{Binding rep_qty, Mode=TwoWay}" Visibility="{Binding VisibilityHideThenText}" Background="{Binding DeliverColor, Mode=TwoWay}" BorderBrush="{Binding DeliverColor, Mode=TwoWay}" InputScope="Number" TextAlignment="Right"  Grid.Column="6" GotFocus="txtQuantity_GotFocus" Margin="6,10,-1,0" Height="39"/>
                        <TextBlock Text="{Binding kor_ldat}" Grid.Row="1" Visibility="{Binding VisibilityHideThenText}" Grid.Column="1" Grid.ColumnSpan="2" FontSize="14" VerticalAlignment="Top" HorizontalAlignment="Left" TextAlignment="Left"></TextBlock>
                        <TextBlock Text="Stock Loc.:  " Grid.Row="1" Grid.Column="3" TextAlignment="Right" VerticalAlignment="Top" FontSize="14" Visibility="{Binding VisibilityHideThenText}"></TextBlock>
                        <TextBlock Grid.Row="1" Visibility="{Binding VisibilityHideThenText}" Tag="{Binding kor_row}" Grid.Column="4" Grid.ColumnSpan="2" VerticalAlignment="Top" FontWeight="Bold" FontSize="14" Tapped="TextBlock_Tapped" Margin="10,0,0,0"><Underline><Run Text="{Binding SelectedLocation, Mode=TwoWay}"/> </Underline></TextBlock>
                        <TextBlock Text="{Binding LocQuantity}" Grid.Row="1" Grid.Column="5" VerticalAlignment="Top" Visibility="{Binding VisibilityHideThenText}" FontSize="14"  TextAlignment="Center"/>

                    </Grid>

                </DataTemplate>

            </GridView.ItemTemplate>
        </GridView>
    </ScrollViewer>

0 个答案:

没有答案