0

I'm working on making a small independent game, and I've reached the point where I'm storing data in XML files, and I'd like to be allow the non-programmers on my team to edit them easily via a GUI, which I'd like to put together with WPF and C#.

I have plenty of experience with C#, but barely any with WPF.

The program would have the following class:

class Foo {
    public string Name;
    public int Age;

    public Foo(string name, int age) {
        Name = name;
        Age = age;
    }
}

And the "database" would just be a

public List<Foo> FooList = new List<Foo>();

What I'd like to make, simplified, is a window with a ListBox on the left side, with "add" and "delete" buttons beneath it (to add and delete items to and from the FooList). The ListBox should have all of the entries in FooList (displaying their Name). On the right side of the window should be a field for Name and Age, and probably some kind of "Save" button.

Now, I could hack this together myself, and I was just about to, when I learned about the existence of data binding. I have no idea how it works (other than that it seems to let you bind controls to variables or something), but it seems like it would make making this a lot easier, right?

I apologize in advance if this seems like too much of a "do everything for me"-type question. I barely know WPF at all, like I said earlier, but I can, for example, handle the serialization and file saving parts myself. I just have no clue how data binding works and how to implement it into my situation (assuming this is even what I want to do).

Thanks in advance!

4

2 回答 2

2

Here's Microsoft's official WPF databinding tutorial. There's a lot here. And there are many similar tutorials all over the intertubes waiting for you just a google search away. http://msdn.microsoft.com/en-us/library/ms752347.aspx

于 2012-07-03T04:31:37.123 回答
0

Simple answer, use XML Notepad to edit XML. It's lightweight enough for non programmers.

http://www.microsoft.com/en-us/download/details.aspx?id=7973

于 2012-07-03T04:28:34.007 回答