我需要帮助来完成我在 Visual Studio 中做的一个简单项目,只是为了学习一点编码。我想显示一个表,其中包含 WPF 中名为 Car 的类的对象,并且该表应该以编程方式完成。
因此,我在 MainWindow.xaml 中添加了一个 ListView 并将 GridView 的名称设置为 GridView1
<Window x:Class="Test.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<ListView HorizontalAlignment="Center" Height="100" Margin="0,10,0,0" VerticalAlignment="Top" Width="100">
<ListView.View>
<GridView x:Name="GridView1">
<GridViewColumn/>
</GridView>
</ListView.View>
</ListView>
</Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)
在 MainWindow.xaml.cs 中我这样做了
using System;
...
//Add this to use DataTable
using System.Data;
namespace Test
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
//create some objects
Car ferrari = new Car("Ferrari","Front-Wheel");
Car mercedes = new Car("Mercedes","Rear-Wheel");
//create …Run Code Online (Sandbox Code Playgroud) 我正在用这种方式在C++中编写一个带有可变数量的参数(和不同类型)的函数
template<typename ...Ts>
void myFunction(Ts ...args)
{
//create std::tuple to access and manipulate single elements of the pack
auto myTuple = std::make_tuple(args...);
//do stuff
return;
}
Run Code Online (Sandbox Code Playgroud)
我想做什么,但我不知道怎样,是从元组推送和弹出元素,特别是第一个元素...类似的东西
//remove the first element of the tuple thereby decreasing its size by one
myTuple.pop_front()
//add addThis as the first element of the tuple thereby increasing its size by one
myTuple.push_front(addThis)
Run Code Online (Sandbox Code Playgroud)
这可能吗?