The root element usually contains other FrameworkElement objects. A ControlTemplate must have only one FrameworkElement as its root element. When you create a ControlTemplate, you combine FrameworkElement objects to build a single control. Specify the visual structure of a control Here's how this CheckBox looks in the Unchecked, Checked, and Indeterminate states after we apply our template. We show the Extensible Application Markup Language (XAML) for the ControlTemplate in the next section. Here's a CheckBox using a ControlTemplate called CheckBoxTemplate1. To use a custom template with a control, assign the ControlTemplate to the Template property of the control. You specify these characteristics in the ControlTemplate of the CheckBox. For example, if you want the content of the check box to be below the selection box, and you want to use an X to indicate that a user selected the check box. You can change these characteristics by creating a ControlTemplate for the CheckBox. Here's a CheckBox using the default ControlTemplate shown in the Unchecked, Checked, and Indeterminate states. These characteristics represent the visual structure and visual behavior of the CheckBox. Important APIs: ControlTemplate class, Control.Template property Custom control template exampleīy default, a CheckBox control puts its content (the string or object next to the CheckBox) to the right of the selection box, and a check mark indicates that a user selected the CheckBox. Here, we show you how to create a ControlTemplate to customize the appearance of a CheckBox control. You can specify additional customizations by creating a template using the ControlTemplate class. But the changes that you can make by setting these properties are limited. Controls have many properties, such as Background, Foreground, and FontFamily, that you can set to specify different aspects of the control's appearance. See: Install/Employ VBA Procedures (Macros)įor instructions to employ the VBA code provided above.You can customize a control's visual structure and visual behavior by creating a control template in the XAML framework. ORng.Start = Selection.Tables(1).Range.End If MsgBox("Do you want to loop to the first control?", vbQuestion + vbYesNo, "Router") = vbYes Thenįor Each oCell In Selection.Tables(1).Range.Cells (1).Range.Selectĭo Until Selection.Cells(1). > 0 The focus does not advance to the next control. Using the tab key in one of these controls enters a physical tab in the control as expected. The following example shows three rich text content controls grouped (nested) in a restricted content rich text control container. Rich text controlsįirst let's look at problems associated with rich text controls. Unfortunately navigating between content controls in documents containing rich text or picture content controls is more problematic. Note: If there are one or more content controls in the document after your assigned "Last" content control then the focus will be set automatically to the content control tagged "First" when you tab out of the "Last" control. Then when you finish in the last content control simply click anywhere in the document and the to exit the content control and the focus will be returned to the content control tagged "First." '"First" = tag property applied to the first control.ĪctiveDocument.SelectContentControlsByTag("First").Item(1).Range.Select '"Last" = tag property applied to the last control. Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |