tailieunhanh - Lập trình .net 4.0 và visual studio 2010 part 50

Phần cho phép bạn giữ nhiều phong cách phức tạp hơn bạn vừa tạo ra. Nó có thể được sử dụng để giữ khá nhiều bất kỳ tập hợp các tài sản mà bạn có thể muốn sử dụng lại. Ví dụ, bạn có thể bao gồm màu sắc, gradients, hay thậm chí kiểm soát mẫu. | CHAPTER 14 SILVERLIGHT INTRODUCTION 6. Open up App. xaml. 7. Inside the block enter the following Style x Key MyStyle TargetType TextBlock Setter Property FontFamily Value Comic Sans MS Setter Property FontSize Value 54 Setter Property Foreground Value FF0000FF Style 8. Now go back to and find the line where it says the following TextBlock FontSize 40 200 25 Silverlight Demo TextBlock 9. Add the following attribute to this tag to reference the style you created in Style StaticResource MyStyle Your tag should now look like this TextBlock FontSize 40 200 25 Style StaticResource MyStyle Silverlight Demo TextBlock The Application .Resources section allows you to hold much more complex styles than you have just created. It can be used to hold pretty much any set of properties you might want to reuse. For example you could include colors gradients or even control templates. Positioning Elements One of the most confusing parts of Silverlight and WPF is element positioning. When you start working with Silverlight and WPF it is quite common to find yourself wondering why an element is not displaying. This is normally due to the following You haven t set the width or height. Your element is obscured by another element. You have positioned the element off the screen. Your element is transparent. Silverlight positions elements using two axes running from the top-left corner of the screen called Left horizontal axis and Top vertical axis . The top-left corner is referred to as coordinates 0 0 see Figure 14-6 . 338 CHAPTER 14 SILVERLIGHT INTRODUCTION Left Top 0 0 Figure 14-6. Silverlight screen coordinates system You are probably expecting to be able to position elements in Silverlight similar to the following code TextBlock Left 10 Top 20 TextBlock However elements are positioned using the and properties unless positioned through some other .

crossorigin="anonymous">
Đã 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.