tailieunhanh - ASP.NET 4 Unleased - p 167
Các trang trong Ví dụ 36,33 chứa kiểm soát MovieView. Mở trang trong thiết kế xem để thấy tác dụng của các thuộc tính thời gian thiết kế khác nhau. Ví dụ, một thể loại và mô tả được kết hợp với cả các thuộc tính Tiêu đề và mô tả trong cửa sổ Properties (xem hình 36,15). | 1634 CHAPTER 36 Building Custom Controls get return _title set _title value Category Movie Description Movie Description public string Description get return _description set _description value protected override void RenderContents HtmlTextWriter writer _title _description protected override HtmlTextWriterTag TagKey get return The page in Listing contains the MovieView control. Open the page in Design view to see the effect of the various design-time attributes. For example a category and description are associated with both the Title and Description properties in the Properties window see Figure . From the Library of Wow eBook Creating a Better Designer Experience 1635 FIGURE The MovieView control in Design view. LISTING @ Page Language C @ Register TagPrefix custom Namespace myControls DOCTYPE html PUBLIC - W3C DTD XHTML Transitional EN http TR xhtml1 DTD html xmlns http 1999 xhtml head id Head1 runat server title Show MovieView title head body form id form1 runat server div 36 custom MovieView id MovieView1 Runat server div form body html From the Library of Wow eBook 1636 CHAPTER 36 Building Custom Controls Creating Control Designers You can modify the appearance of your custom controls in Design view by creating a ControlDesigner. The Framework enables you to implement a number of fancy features when you implement a ControlDesigner. This section focuses on just two of these advanced features. First you learn how to create a ContainerControlDesigner. A ContainerControlDesigner enables you to drag and drop other controls from the Toolbox onto your control in Design view. You also learn how to add Smart Tags also called Action Lists to your control. When a control supports Smart Tags a menu of common tasks pop up above the control in Design view. .
đang nạp các trang xem trước