Code Snippets
Throughout this section of the documentation you will find fully functional code snippets that demonstrate a variety of features used in real-life scenarios.
Manipulating Data
-
- Entering edit when a cell is current
- Using a masked text box
- Handling routed edit events
- Defining foreign key configurations
- Custom key/value mappings
-
- Filtering data items (Filter event)
- Enabling automatic filtering
- Providing a new auto-filter control style
- Creating external auto-filter controls
- Providing custom distinct values
- Using a filter row
- Providing default filter criteria
- Enabling and disabling advanced filtering
- Applying a style to localize the operators
-
- Grouping data items
- Preventing grouping and sorting
- Defining a default group configuration
- Programmatically toggling group expansion
- Custom grouping
- Changing the group-header text
- Providing a group-configuration selector
- Creating a group-configuration selector
-
Providing, Inserting, and Removing Data
- Binding to a data table
- Binding to an array
- Retrieving values from the current item
- Initializing an insertion row
- Providing unbound data
- Binding to a LINQ query (SQL)
- Binding to a LINQ query (XML)
- Binding to a master/detail data table
- Defining detail descriptions
- Manually handling the insertion process
- Deleting selected items
- Providing unbound data (DataGridUnboundItemProperty)
- Binding to an IQueryable source
-
- Sorting data items
- Preventing sorting and grouping
- Custom sorting
- Handling collection-changed events
- Providing a custom sort comparer
-
- Providing a cell error style
- Providing binding-level validation
- Providing UI-level validation
-
- Displaying statistical functions
- Changing statistical contexts
- Custom statistical-result layout
- Displaying statistical functions in details
- Custom statistical function
Master/Detail
- Binding to a Master/Detail Data Table
- Creating a Custom Detail Description
- Defining Detail Descriptions
- Indenting a Non-row Item in a Detail Configuration Header
- Providing a Default Detail Configuration
- Providing a Detail Configuration Item-container Style
- Retrieving Child Contexts
- Using Routed View Properties
Views and Themes
-
- Setting a view and theme through attribute syntax
- Setting a view and theme through property element syntax
- Displaying a scroll tip
- Enabling the column chooser
-
- Providing surface configurations
- Providing an empty-surface brush
- Applying a grid background brush
- Applying a card background brush
- Coercing a surface configuration
-
- Adding an InsertionRow to the fixed headers
- Clearing a fixed header section
- Changing the main (primary column)
- Adding separator lines
- Recreating the default card-view header
- Applying a grid background brush
- Applying a card background brush
- Customizing Table Views
- Adding an InsertionRow to the fixed headers
- Clearing a fixed header section
- Adding vertical and horizontal grid lines
- Hiding the group-level indicator pane
- Hiding the row-selector pane
- Fixing columns
- Allowing horizontal scrolling
- Using routed view properties
- Stretching columns
- Applying a grid background brush
-
Customizing Multi-surface Themes
- Providing surface configurations
- Providing a default region configuration
- Defining region configurations
- Setting a multi-surface theme
- Changing a title-region position
- Providing new gradient colors
- Creating a custom surface configuration and multi-surface theme
Customizing Appearance
-
- Providing a simple cell editor
- Providing a complex cell editor
- Providing a default cell editor
-
- Styling data cells
- Styling data cells through triggers
- Alternating data-row styles
- Styling a fixed-column splitter
- Changing the background color of a data row
- Forcing items in the fixed headers to occupy all the available width
- Styling row selectors
- Providing a detail configuration item-container style
- Changing the no-group content
- Centering column titles
- Applying a card background brush
-
- Providing a cell-content template
- Providing a group-header control template
- Providing a data cell template
- Providing a data row template for table view types
- Providing a data row template for card view types
- Providing an insertion row template
- Formatting a cell's content
- Changing the group-header text
Other
-
- Persisting and loading settings using an XmlSerializer
- Persisting and loading settings through the application settings
-
- Configuring a print view
- Configuring a progress window
- Styling a page
- Exporting to Excel (ExcelExporter class)
- Exporting to Excel (ExportToExcel method)
- Changing the group-header formats
-
Retrieving a Reference to an Item in a Header or Footer Section
-
Retrieving the value of the content of a cell through its data source item
Tutorials
-
Creating a Custom Theme: Step-by-step tutorial that takes you through creating a custom theme is also available.
-
Creating a Custom Multi-surface Theme and Surface Configuration: Because creating a custom surface configuration and multi-surface theme requires more than a code snippet to demonstrate, links to the required classes are provided below:
-
ImageAndDoubleTitleSurfaceConfiguration Class
Provides the implementation, in code, of a surface configuration that derives from the
ImageAndTitleSurfaceConfigurationclass and adds a newRegionConfigurationproperty named "SecondTitleRegionConfiguration". TheTargetRegionPresenterNameattribute, which specifies the name of the corresponding RegionPresenter in the ControlTemplate ("REGION_SecondTitle"), has also been set on the new property. -
ElementalPinkTheme Class
Provides the implementation, in code, of a theme that derives from the
ElementalBlackThemeclass and adds a new RegionConfiguration property named "DefaultSecondTitleRegionConfiguration". TheTargetRegionPresenterNameattribute, which specifies the name of the corresponding RegionPresenter in the ControlTemplate ("REGION_SecondTitle"), has also been set on the new property.The
TargetSurfaceConfigurationattribute has also been set on theElementalPinkThemeclass to include theImageAndDoubleTitleSurfaceConfigurationclass as a targeted surface configuration. -
CardflowView3D.Elemental.Pink.xaml Resource Dictionary
Based on the CardflowView3D.Elemental.Black resource dictionary, this dictionary provides the pink color scheme for the
Elemental Pinktheme as well as the modified ControlTemplate that contains the second title region identified as "REGION_SecondTitle". -
Elemental.Resources.xaml Resource Dictionary
Exact copy of Xceed's Elemental.Resources resource dictionary, which provides the templates and styles required by the
CardflowView3D.Elemental.Pinkresource dictionary. -
generic.xaml Resource Dictionary
The theme-level resource dictionary for the
Elemental Pinktheme, which must be placed in a themes folder at the root of the project that contains the theme.