TAILIEUCHUNG - Apress-Visual CSharp 2010 Recipes A Problem Solution Approach_8

GetTemplateChild để tìm thấy các nút được xác định bởi mẫu thực tế của nó. Nếu điều này tồn tại, nó cho biết thêm một sự kiện xử lý sự kiện Click của nút. Mã cho kiểm soát như sau: sử dụng bằng cách sử dụng bằng cách sử dụng bằng cách sử dụng System | CHAPTER 17 WINDOWS PRESENTATION FOUNDATION GetTemplateChild to find the button defined by its actual template. If this exists it adds an event handler to the button s Click event. The code for the control is as follows using using using using namespace TemplatePart Name PART_Browse Type typeof Button ContentProperty FileName public class FileInputControl Control static FileInputControl r typeof FileInputControl new FrameworkPropertyMetadata typeof FileInputControl public override void OnApplyTemplate Button browseButton PART_Browse as Button if browseButton null new RoutedEventHandler browseButton_Click void browseButton_Click object sender RoutedEventArgs e OpenFileDialog dlg new OpenFileDialog if true public string FileName get . return string GetValue FileNameProperty 830 CHAPTER 17 WINDOWS PRESENTATION FOUNDATION set SetValue FileNameProperty value public static readonly Dependencyproperty FileNameProperty FileName typeof string typeof FileInputControl The default style and control template for FileInputControl is in a ResourceDictionary in the Themes subfolder and is merged into the Generic ResourceDictionary. The XAML for this style is as follows ResourceDictionary xmlns http winfx 2006 xaml presentation xmlns x http winfx 2006 xaml xmlns local clr-namespace assembly Style TargetType x Type local FileInputControl Setter Property Template ControlTemplate TargetType x Type local FileInputControl Border Background TemplateBinding Background BorderBrush TemplateBinding BorderBrush BorderThickness TemplateBinding BorderThickness DockPanel Button x Name PART_Browse Right .

TỪ KHÓA LIÊN QUAN
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.