Technology Programming

WPF 4: Selection and Caret Customization

In the past WPF versions, the selection color and caret color for text input and reading controls, such as TextBox, RichTextBox, FlowDocumentReader etc.
, have been hard coded.
WPF 4 includes properties for the SelectionBurhs and CaretBrush, which will enable developers to control the brush used for drawing both selection and carets in a multitude of WPF controls, thus making for one of the great WPF strengths, simple app customization.
ClearTypeHint This feature allows WPF developers to enable cleartype when they render text to IntermediateRender targets, where cleartype would usually be disabled by the system.
Cleartype is usually disabled on IRTs because it only works properly when it is rendered to an opaque surface, and the system can not determine with ease if an IRT is transparent or not.
If a developer sets this to true, then he will let the system know that the IRT is transparent and he will be able to enable cleartype with layered windows, in Visual / Drawing brushes, Effects and in 3D according to his choice.
Layout Rounding Among the features adopted from Silverlight 2 is the LayoutRounding property, which WPF 4 will incorporate.
WPF's layout engine normally calculates sub-pixel positioning coordinates, which can turn to rendering artifacts as elements positioned on sub-pixel boundaries which are initialized over multiple physical pixels.
As such, this feature will train the layout engine to place elements on whole pixel boundaries, in this way removing most of the rendering artifacts caused by this problem.
Data binding As data binding goes, WPF 4 has the BindindExpressionBase.
ValidateWithoutUpdate which acts for a single binding expression like the BindingGroup.
ValidateWithoutUpdate for a binding group, i.
e.
It starts the validate / update process, stopping it just before writing a value back to the source item.
As for BindingGroup.
SharesProposedValues, when this is set to true, the binding group will keep track of proposed values even if the UI elements that hold them are replaced.
This feature, for example, supports a UI design pattern used by DataGrid, where a single source property is presented with an "editing template" (containing editable controls like TextBox), while other properties appear with "display templates" (which contain non-editable controls, such as TextBlock).
When the user centers on a new property, the display template is replaced by an editing one, while the previously editing template of the focused property is replaced by a display template.
The new BindingGroup manages the proposed value of the old editing template, so that it may be displayed in the display template and written back to the source when the user commits the binding group.

Leave a reply