【问题标题】:Grid view w/ progress bars?带进度条的网格视图?
【发布时间】:2010-05-05 22:07:20
【问题描述】:

尝试确定用于网格视图的最佳元素,与您在 uTorrent 或任何其他上传/下载客户端中看到的元素非常相似。具体来说,我也想要一个“进度”列(带有进度条)。使用 VS2010/.NET4。还没有真正开始这个项目,所以 WPF 或 WinForms 都可以。你会推荐什么?

【问题讨论】:

  • 我会推荐 WPF,但您将其标记为 WinForms。
  • @Henk:也许我弄错了。我真的不知道你所说的控件是什么。我去File > New Project > C# > Windows Forms Application。它给了我一堆控件,我可以将它们拖到我的表单上。不管你怎么称呼。
  • 马克,去File > New Project > C# > WPF Application 一个全新的世界。
  • Mark - Henk 的观点是,现在有两个平台可以在 Visual Studio 中构建桌面客户端 - Windows 窗体应用程序和 Windows Presentation Foundation (WPF) 应用程序。除非您必须使用 Windows 窗体,否则请使用 WPF(创建一个新的 WPF 项目,而不是 Windows 窗体)WPF 为您提供了更好的 UI 选项。
  • @David:哦……你是对的。这是一个全新的世界。以前没见过这个。 WinForms 总是排在第一位,没有意识到我还有其他选择 :D 仍然......那么 WPF 控件将适合该法案吗?

标签: c# wpf winforms visual-studio-2010 .net-4.0


【解决方案1】:

事实证明,您可以在其中填充 ProgressBars:

<DataGrid Name="dataGrid1" ItemsSource="{Binding Path=Items}" CanUserAddRows="False" CanUserDeleteRows="False" CanUserResizeRows="False" HeadersVisibility="Column" GridLinesVisibility="None" AutoGenerateColumns="False">
    <DataGrid.Columns>
        <DataGridTextColumn Binding="{Binding Path=Uri, Mode=OneWay}" Header="Uri" IsReadOnly="True" />
        <DataGridTextColumn Binding="{Binding Path=Size, Mode=OneWay}" Header="Size" IsReadOnly="True" />
        <DataGridTemplateColumn Header="Progress">
            <DataGridTemplateColumn.CellTemplate>
                <DataTemplate>
                    <ProgressBar Value="{Binding Path=Progress, Mode=OneWay}" />
                </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>
        </DataGridTemplateColumn>
        <DataGridTextColumn Binding="{Binding Path=Eta, Mode=OneWay}" Header="Eta" IsReadOnly="True" />
        <DataGridTextColumn Binding="{Binding Path=Priority, Mode=OneWay}" Header="Priority" IsReadOnly="True" />
    </DataGrid.Columns>
</DataGrid>

对我接近 0 的 WPF 知识有点摸索,但到目前为止它看起来很不错。

【讨论】:

    【解决方案2】:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-12
      • 1970-01-01
      • 1970-01-01
      • 2014-12-17
      • 2014-04-02
      • 2020-09-28
      相关资源
      最近更新 更多