TAILIEUCHUNG - Visual studio 2010 part 26

Microsoft Visual Studio 2010: A của Hướng dẫn mới bắt đầu Chú ý rằng lớp trong mã này được đặt tên NewOrder, minh họa cho một cửa sổ chỉ là một lớp. Như bạn biết, bạn có thể khởi tạo các lớp học và gọi phương pháp của họ, đó là kỹ thuật bạn sẽ sử dụng để mở cửa sổ từ các xử lý sự kiện NewOrder_Click trong code-behind của cửa sổ MainWindow. | 234 Microsoft Visual Studio 2010 A Beginner s Guide Notice that the class in this code is named NewOrder illustrating that a window is just another class. As you know you can instantiate classes and call their methods which is the technique you ll use to open this window from the NewOrder_Click event handler in the code-behind of the MainWindow window. In practice you ll populate the NewOrder window with whatever controls you need to implement a new order. You would populate the window by dragging and dropping controls just like the Button in this example. However we ll skip that task for now because the current focus is on adding code to the NewOrderButton_Click event handler so that you can learn how to code an event handler and open another window. Go back to the NewOrderButton_Click event handler in and add the following code C private void NewOrderButton_Click object sender RoutedEventArgs e NewOrder newOrd new NewOrder VB Private Sub NewOrderButton_Click ByVal sender As ByVal e As Handles Dim newOrd As New NewOrder End Sub Since NewOrder is a class you can instantiate it as shown in the preceding code example. To open the window call the Show method. Now you have a WPF program that handles events and opens new windows. Press F5 to run the program. Click New Order and observe that the New Order window appears. The New Order window isn t very useful because it lacks controls and data management. The next section shows you how to populate window controls with data. Working with Data in WPF This section builds upon what you learned in Chapter 7 by showing how to bind data to WPF controls. Binding is the process of populating and retrieving data to and from controls. You ll learn how to show data in your user interface. The examples in the Chapter 8 Building Desktop Applications with WPF 235 following sections show you how to perform create read update and

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.