Help information built petzolld FlowDocument objects is available. This website uses cookies to improve your experience while you navigate through the website.
Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are as essential for the working of basic functionalities of the website.
We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience. Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website.
Learn more about editing in Visual Studio. Professional, sophisticated experiences. Video: Blend for Visual Studio Azure, Office , Salesforce and more. Debug and analyze.
Troubleshoot, diagnose, fix. Learn more about debugging in Visual Studio. Measure, identify, improve. Video: Overview of Application Timeline Tool. Learn more about diagnostics in Visual Studio. Validate, automate, manage. Package, publish, update. Vibrant ecosystem. Open source, controls, frameworks, and tools. For example, the following figure shows 2D images rendered onto 3D shapes:. For more information, see 3D graphics overview. WPF animation support lets you make controls grow, shake, spin, and fade, to create interesting page transitions, and more.
You can animate most WPF classes, even custom classes. The following figure shows a simple animation in action:. For more information, see Animation overview.
As a demonstration of text integration with graphics, the following figure shows the application of text decorations:. For more information, see Typography in Windows Presentation Foundation.
Often, though, the basics aren't enough for creating and managing a truly distinct and visually stunning user experience. The standard WPF controls might not integrate with the desired appearance of your application. Data might not be displayed in the most effective way. Your application's overall user experience may not be suited to the default look and feel of Windows themes. The main purpose of most of the WPF controls is to display content.
In WPF, the type and number of items that can constitute the content of a control is referred to as the control's content model. Some controls can contain a single item and type of content. For example, the content of a TextBox is a string value that is assigned to the Text property.
Other controls, however, can contain multiple items of different types of content; the content of a Button , specified by the Content property, can contain various items including layout controls, text, images, and shapes. For more information on the kinds of content that is supported by various controls, see WPF content model. Although the main purpose of XAML markup is to implement an application's appearance, you can also use XAML to implement some aspects of an application's behavior.
One example is the use of triggers to change an application's appearance based on user interactions. For more information, see Styles and templates. The default user interfaces for WPF controls are typically constructed from other controls and shapes. The ButtonChrome provides the standard button appearance, while the ContentPresenter displays the button's content, as specified by the Content property.
Sometimes the default appearance of a control may conflict with the overall appearance of an application. In this case, you can use a ControlTemplate to change the appearance of the control's user interface without changing its content and behavior. For example, a Button raises the Click event when it's clicked. By changing the template of a button to display an Ellipse shape, the visual of the aspect of the control has changed, but the functionality hasn't.
You can still click on the visual aspect of the control and the Click event is raised as expected. Whereas a control template lets you specify the appearance of a control, a data template lets you specify the appearance of a control's content.
Data templates are frequently used to enhance how bound data is displayed. The following figure shows the default appearance for a ListBox that is bound to a collection of Task objects, where each task has a name, description, and priority:. The default appearance is what you would expect from a ListBox. However, the default appearance of each task contains only the task name.
To show the task name, description, and priority, the default appearance of the ListBox control's bound list items must be changed by using a DataTemplate. Here is an example of applying a data template that was created for the Task object.
The ListBox retains its behavior and overall appearance and only the appearance of the content being displayed by the list box has changed. For more information, see Data templating overview. Styles enable developers and designers to standardize on a particular appearance for their product.
WPF provides a strong style model, the foundation of which is the Style element. Styles can apply property values to types. They can be applied automatically to the everything according to the type or individual objects when referenced. The following example creates a style that sets the background color for every Button on the window to Orange :. Because this style targets all Button controls, the style is automatically applied to all the buttons in the window, as shown in the following figure:.
Controls in an application should share the same appearance, which can include anything from fonts and background colors to control templates, data templates, and styles. You can use WPF's support for user interface resources to encapsulate these resources in a single location for reuse. The following example defines a common background color that is shared by a Button and a Label :. For more information, see How to define and reference a WPF resource. Although WPF provides a host of customization support, you may encounter situations where existing WPF controls do not meet the needs of either your application or its users.
This can occur when:. At this point, however, you can take advantage of one of three WPF models to create a new control. Each model targets a specific scenario and requires your custom control to derive from a particular WPF base class.
The three models are listed here:. User Control Model A custom control derives from UserControl and is composed of one or more other controls. Control Model A custom control derives from Control and is used to build implementations that separate their behavior from their appearance using templates, much like most WPF controls. Deriving from Control allows you more freedom for creating a custom user interface than user controls, but it may require more effort.
Framework Element Model. A custom control derives from FrameworkElement when its appearance is defined by custom rendering logic not templates. For more information on custom controls, see Control authoring overview. Skip to main content. This browser is no longer supported.
0コメント