【问题标题】:Datagrid is not supported in a Windows Apps ProjectWindows 应用项目不支持 Datagrid
【发布时间】:2015-03-31 04:00:46
【问题描述】:

我正在尝试遵循这个 SO answer,但是我是 Visual Studio 正在抱怨 Windows 应用程序项目中不支持 Datagrid?我可以使用 Datagrid 的替代品吗?

最终我想创建一个按钮网格,对应于 List menuLists 中的 MenuItem

我是数据绑定的新手,所以如果有人有更好的东西我应该看看,请告诉我。

<Page
    x:Class="App1.Pages.MenuItemsPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:App1.Pages"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
    <Page.Resources>
        <CollectionViewSource x:Key="MenuItemsCollectionViewSource" Source="{Binding MenuItems}"/>
    </Page.Resources>

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <DataGrid Grid.Row ="0" ItemsSource ="{Binding Source = {StaticResource MenuItemsCollectionViewSource}}" />
    </Grid>
</Page>

【问题讨论】:

    标签: c# wpf xaml datagrid


    【解决方案1】:

    我想通了。我在处理 Pages 时应该使用 GridView。

    【讨论】:

      【解决方案2】:

      当我将Targer framework 更改为.NET Framework 4.5 时,同样的问题也解决了。原来是NET Framework 3。它可以在项目属性中更改。

      【讨论】:

        【解决方案3】:

        没有控制。可能有第三方控件,或者你可以通过模板化 ListView 来获得类似的布局。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2017-08-10
          • 2014-04-13
          • 1970-01-01
          • 2012-10-17
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多