WPF中代表的电影院座位表 [英] cinema seating chart to represent in WPF

查看:376
本文介绍了WPF中代表的电影院座位表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我是WPF的新手(我以前曾经开发过Windows应用程序),但是我想尝试使用WPF,ADO.NET和C#.NET来构建应用程序.
我不知所措;我不知道该如何在WPF中表示电影院的座位表.我谨记要在WPF中的网格中放置一组按钮,每个按钮代表电影院的座位.现在,我想将这些按钮绑定到数据表中的字段,并在将座椅标记为已售出"时更改按钮单击时按钮的外观.
我应该为sql表中的每个席位创建字段以便能够绑定到WPF表单中的按钮吗?还是我应该为座位表创建一个类并为座位创建一个列表,并将列表的元素绑定到按钮上?
如果有人可以帮助我,我将非常高兴.我做了一些研究,但找不到与我打算做的相似的代码.
预先感谢.

Hello there,
I am new to WPF (I used to develop windows applications before), but i want to try to build an application using WPF, ADO.NET and C#.NET.
I am quite lost as i don;t know how should i represent a cinema seating chart in WPF. I have in mind to place inside a grid in a WPF form a set of buttons, each representing a seat in the cinema hall. Now i want to bind these buttons to fields in a Datatable and change the appearance of the button on button click, when the seat is to be tagged as sold, for example.
Should i be creating fields for each seat in sql table to be able to bind to a button in the WPF form? Or should i be creating a class for the seating chart and have a list for the seats and bind the list''s elements to the buttons?
If somebody can help me i will be very glad. I did some research but could not find any code resembling what i intend to do.
Thanks in advance.

推荐答案

@ YAROJAN77

最好的实现方法是使用ListBox并覆盖ItemTemplate和ItemPanel.

我这里有一个小样本.检查一下,可能会为您提供一些见识.祝一切顺利.

https://sites.google.com/site/html5tutorials/DataGridCheckBoxSelection.zi [ ^ ]
@YAROJAN77

Best way to implement is using the ListBox and overriding the ItemTemplate and ItemPanel.

I have a small sample here. Check that out, that might give you some insight. All the best.

https://sites.google.com/site/html5tutorials/DataGridCheckBoxSelection.zi[^]


你好,
非常感谢您的指导.
尽管我需要显示板子(座位图),但不能像您的代码中那样将其显示为网格.
但是,在您的代码中还有其他一些对我有益的事情,所以,谢谢lotttt !!!
Hello there,
Thanks a lot for your guidance.
Although I need to display the board (the map of the seats) and i cannot display it as grid as in your code.
There are other things that are beneficial to me in your code, however, so thanks a lotttt!!!


这篇关于WPF中代表的电影院座位表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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