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

Trong phiên bản trước của WPF, văn bản đôi khi có thể xuất hiện một chút mờ. Điều này là cố định trong WPF 4,0 (có thể do sự cần thiết cho văn bản rõ ràng trong VS2010 IDE) và bây giờ bạn có nhiều kiểm soát tốt hơn-hạt hơn như thế nào là ra văn bản với TextFormattingMode mới và TextRenderingMode tài sản | CHAPTER 15 WPF AND SILVERLIGHT Input Bindings Now Support Bindings In previous releases of WPF it was quite tricky to set binding to input keys using the InputBinding class. This was because the Command property was not a dependency property and also didn t inherit the parent s data context. This could make certain scenarios such as implementing the MVVM pattern difficult. This is resolved in WPF . InputBinding MouseBinding and KeyBinding now inherit from Freezable and various related properties are now made dependency properties. This should then allow you to write input binding XAML such as the following KeyBinding Modifiers Control Key L Command Binding MyCustomCommand Text-Rendering Improvements In previous releases of WPF text could sometimes appear a bit blurry. This is fixed in WPF possibly driven by the need for clear text in VS2010 IDE and you now have much finer-grained control over how text is rendered with the new TextFormattingMode and TextRenderingMode properties. TextFormatting mode allows you to set the text metrics that WPF will use for formatting text. TextFormatting mode has two settings Ideal as per previous versions Display ensures that every glyph s position and width is not fractional which is very similar to how the GDI renders text The following code demonstrates setting text to use the Display setting TextBlock Display Hello I am using new Display mode formatting TextBlock Setting text to Display mode will in many cases make the text look darker and clearer. In Figure 1520 the first paragraph uses the old Ideal setting the second uses the new Display setting yes the difference is subtle especially in print but try it for yourself . 382 CHAPTER 15 WPF AND SILVERLIGHT MainWindow Lorem ipsum dolor sit amet consectetur adipiscing elit Pellentesque eu magna magna sed pulvinar urna. Proin lacinia augue nec urna dictum ac