如何在UWP应用中自定义数据网格 [英] How to customize the datagrid in UWP apps

查看:72
本文介绍了如何在UWP应用中自定义数据网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在实施UWP应用程序。该应用程序的模型包括以下设计:在数据网格内的同一列中显示图像和文本,并根据某些情况突出显示网格列几秒钟。

I am currently implementing an UWP application. The mockups for the application includes design for displaying an image and text in same column within data grid and highlighting the grid column for few seconds based on some condition.

据我所知,UWP中没有可用于DataGrid的控件,所以如果市场上有其他可用的Grid供我使用,请告诉我数据网格还是需要自定义DataGrid以满足我们的要求?

As far as I know there is no control available for DataGrid in UWP, so please suggest me if there is any other Grid available in market which I can used as an alternative for datagrid or we need to customize the DataGrid to meet our requirements?

推荐答案

请参阅以下问题
如何在UWP中添加dataGrid

使用Microsoft.Toolkit.Uwp.UI.Controls.DataGrid Res: https://docs.microsoft.com/zh-cn/windows/uwpcommunitytoolkit/controls/datagrid

use Microsoft.Toolkit.Uwp.UI.Controls.DataGrid Res: https://docs.microsoft.com/en-us/windows/uwpcommunitytoolkit/controls/datagrid

Exp:< a href = https://github.com/Microsoft/WindowsCommunityToolkit//tree/harinikmsft/datagrid/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid rel = nofollow noreferrer> https://github.com。 com / Microsoft / WindowsCommunityToolkit // tree / hari nikmsft / datagrid / Microsoft.Toolkit.Uwp.UI.Controls.DataGrid / DataGrid

xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"



<Page.Resources>
    <CollectionViewSource x:Name="CVSposts" />
</Page.Resources>
<Grid>

    <controls:DataGrid x:Name="DataGridTTT" AutoGenerateColumns="False"  x:DefaultBindMode="TwoWay" Grid.Row="1" >
            <controls:DataGrid.Columns>
                <controls:DataGridTextColumn Header="PostId"   Binding="{Binding PostId}" />
                <controls:DataGridTextColumn Header="Title"  Binding="{Binding Title}" />
            <controls:DataGridTextColumn Header="Content1"  Binding="{Binding Content1}" />
            <controls:DataGridTemplateColumn Tag="Col">
                    <controls:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate  >
                            <Grid Name="Grid1" Tag="{Binding BlogId, Mode=TwoWay , UpdateSourceTrigger=PropertyChanged}">
                                <ComboBox  x:Name="ComboBoxTTT"     
                            SelectedValue="{Binding BlogId, Mode=TwoWay , UpdateSourceTrigger=PropertyChanged}"
                                SelectedValuePath="BlogId"   DisplayMemberPath="Url"   ItemsSource="{Binding Blogss}"
                                />
                            </Grid>
                        </DataTemplate>
                    </controls:DataGridTemplateColumn.CellTemplate>
                </controls:DataGridTemplateColumn>

            </controls:DataGrid.Columns>
        </controls:DataGrid>

</Grid>

这篇关于如何在UWP应用中自定义数据网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆