DomainDataSource Class
[WCF RIA Services Version 1 Service Pack 2 is compatible with either .NET framework 4 or .NET Framework 4.5, and with either Silverlight 4 or Silverlight 5.]
Provides an object for loading, filtering, grouping, and sorting data collections.
Inheritance Hierarchy
System.Object
System.Windows.DependencyObject
System.Windows.UIElement
System.Windows.FrameworkElement
System.Windows.Controls.Control
System.Windows.Controls.DomainDataSource
Namespace: System.Windows.Controls
Assembly: System.Windows.Controls.DomainServices (in System.Windows.Controls.DomainServices.dll)
Syntax
'Declaration
<TemplateVisualStateAttribute(Name := "Unchanged", GroupName := "ChangeStates")> _
<TemplateVisualStateAttribute(Name := "Changed", GroupName := "ChangeStates")> _
<TemplateVisualStateAttribute(Name := "Normal", GroupName := "CommonStates")> _
<TemplateVisualStateAttribute(Name := "Disabled", GroupName := "CommonStates")> _
<TemplateVisualStateAttribute(Name := "Idle", GroupName := "ActivityStates")> _
<TemplateVisualStateAttribute(Name := "Loading", GroupName := "ActivityStates")> _
<TemplateVisualStateAttribute(Name := "Submitting", GroupName := "ActivityStates")> _
Public Class DomainDataSource _
Inherits Control
'Usage
Dim instance As DomainDataSource
[TemplateVisualStateAttribute(Name = "Unchanged", GroupName = "ChangeStates")]
[TemplateVisualStateAttribute(Name = "Changed", GroupName = "ChangeStates")]
[TemplateVisualStateAttribute(Name = "Normal", GroupName = "CommonStates")]
[TemplateVisualStateAttribute(Name = "Disabled", GroupName = "CommonStates")]
[TemplateVisualStateAttribute(Name = "Idle", GroupName = "ActivityStates")]
[TemplateVisualStateAttribute(Name = "Loading", GroupName = "ActivityStates")]
[TemplateVisualStateAttribute(Name = "Submitting", GroupName = "ActivityStates")]
public class DomainDataSource : Control
[TemplateVisualStateAttribute(Name = L"Unchanged", GroupName = L"ChangeStates")]
[TemplateVisualStateAttribute(Name = L"Changed", GroupName = L"ChangeStates")]
[TemplateVisualStateAttribute(Name = L"Normal", GroupName = L"CommonStates")]
[TemplateVisualStateAttribute(Name = L"Disabled", GroupName = L"CommonStates")]
[TemplateVisualStateAttribute(Name = L"Idle", GroupName = L"ActivityStates")]
[TemplateVisualStateAttribute(Name = L"Loading", GroupName = L"ActivityStates")]
[TemplateVisualStateAttribute(Name = L"Submitting", GroupName = L"ActivityStates")]
public ref class DomainDataSource : public Control
[<TemplateVisualStateAttribute(Name = "Unchanged", GroupName = "ChangeStates")>]
[<TemplateVisualStateAttribute(Name = "Changed", GroupName = "ChangeStates")>]
[<TemplateVisualStateAttribute(Name = "Normal", GroupName = "CommonStates")>]
[<TemplateVisualStateAttribute(Name = "Disabled", GroupName = "CommonStates")>]
[<TemplateVisualStateAttribute(Name = "Idle", GroupName = "ActivityStates")>]
[<TemplateVisualStateAttribute(Name = "Loading", GroupName = "ActivityStates")>]
[<TemplateVisualStateAttribute(Name = "Submitting", GroupName = "ActivityStates")>]
type DomainDataSource =
class
inherit Control
end
public class DomainDataSource extends Control
The DomainDataSource type exposes the following members.
Constructors
Name | Description | |
---|---|---|
DomainDataSource | Initializes a new instance of the DomainDataSource class. |
Top
Properties
Name | Description | |
---|---|---|
ActualHeight | (Inherited from FrameworkElement.) | |
ActualWidth | (Inherited from FrameworkElement.) | |
AllowDrop | (Inherited from UIElement.) | |
AutoLoad | Gets or sets a value indicating whether Load is automatically invoked when a change occurs that impacts the query composed by the DomainDataSource. | |
Background | (Inherited from Control.) | |
BorderBrush | (Inherited from Control.) | |
BorderThickness | (Inherited from Control.) | |
CacheMode | (Inherited from UIElement.) | |
CanLoad | Gets a value indicating whether the control can perform a load operation based on the present state. | |
Clip | (Inherited from UIElement.) | |
Cursor | (Inherited from FrameworkElement.) | |
Data | Gets the entities resulting from the last load operation, as an IEnumerable. | |
DataContext | (Inherited from FrameworkElement.) | |
DataView | Gets the current view of entities resulting from the last load operation, using a DomainDataSourceView. | |
DefaultStyleKey | (Inherited from Control.) | |
DesignData | Gets or sets the data to use at design time. | |
DesiredSize | (Inherited from UIElement.) | |
Dispatcher | (Inherited from DependencyObject.) | |
DomainContext | Gets or sets the DomainContext instance used for executing the load and submit operations. | |
FilterDescriptors | Gets the collection of FilterDescriptor objects used when performing loads. | |
FilterOperator | Gets or sets the logical operator used for combining FilterDescriptor objects in the filters collection. | |
FlowDirection | (Inherited from FrameworkElement.) | |
FontFamily | (Inherited from Control.) | |
FontSize | (Inherited from Control.) | |
FontStretch | (Inherited from Control.) | |
FontStyle | (Inherited from Control.) | |
FontWeight | (Inherited from Control.) | |
Foreground | (Inherited from Control.) | |
GroupDescriptors | Gets the collection of grouping objects that are used to organize the data into groups. | |
HasChanges | Gets a value indicating whether the items exposed by this DomainDataSource have pending changes. | |
Height | (Inherited from FrameworkElement.) | |
HorizontalAlignment | (Inherited from FrameworkElement.) | |
HorizontalContentAlignment | (Inherited from Control.) | |
IsBusy | Gets a value indicating whether this DomainDataSource is loading data or submitting changes. | |
IsEnabled | (Inherited from Control.) | |
IsHitTestVisible | (Inherited from UIElement.) | |
IsLoadingData | Gets a value indicating whether the DomainDataSource is currently loading data. | |
IsSubmittingChanges | Gets a value indicating whether the DomainDataSource is currently submitting changes as a result of a call to SubmitChanges. | |
IsTabStop | (Inherited from Control.) | |
Language | (Inherited from FrameworkElement.) | |
LoadCommand | Gets an ICommand that invokes Load on this DomainDataSource. | |
LoadDelay | Gets or sets the delay before an automatic data loading operation is started. | |
LoadInterval | Gets or sets the duration between two successive data loading operations in a progressive data loading scenario. | |
LoadSize | Gets or sets the maximum number of items to load each time a Load is executed. When equal to 0, all requested entities will be loaded. | |
Margin | (Inherited from FrameworkElement.) | |
MaxHeight | (Inherited from FrameworkElement.) | |
MaxWidth | (Inherited from FrameworkElement.) | |
MinHeight | (Inherited from FrameworkElement.) | |
MinWidth | (Inherited from FrameworkElement.) | |
Name | (Inherited from FrameworkElement.) | |
Opacity | (Inherited from UIElement.) | |
OpacityMask | (Inherited from UIElement.) | |
Padding | (Inherited from Control.) | |
PageSize | Gets or sets the number of items displayed on each page of the view returned from the Data and DataView properties, or 0 to disable paging. | |
Parent | (Inherited from FrameworkElement.) | |
Projection | (Inherited from UIElement.) | |
QueryName | Gets or sets the name of the query to use for loading. | |
QueryParameters | Gets the collection of Parameter objects representing arguments of the EntityQuery<TEntity> method specified by the QueryName property. | |
RefreshInterval | Gets or sets the interval between automatic Load operations to refresh the data with any changes that may have occurred on the server. | |
RejectChangesCommand | Gets an ICommand that invokes RejectChanges on this DomainDataSource. | |
RenderSize | (Inherited from UIElement.) | |
RenderTransform | (Inherited from UIElement.) | |
RenderTransformOrigin | (Inherited from UIElement.) | |
Resources | (Inherited from FrameworkElement.) | |
SortDescriptors | Gets the collection of sort descriptor objects that are used to sort the data. | |
Style | (Inherited from FrameworkElement.) | |
SubmitChangesCommand | Gets an ICommand that invokes SubmitChanges on this DomainDataSource. | |
TabIndex | (Inherited from Control.) | |
TabNavigation | (Inherited from Control.) | |
Tag | (Inherited from FrameworkElement.) | |
Template | (Inherited from Control.) | |
Triggers | (Inherited from FrameworkElement.) | |
UseLayoutRounding | (Inherited from UIElement.) | |
VerticalAlignment | (Inherited from FrameworkElement.) | |
VerticalContentAlignment | (Inherited from Control.) | |
Visibility | (Inherited from UIElement.) | |
Width | (Inherited from FrameworkElement.) |
Top
Methods
Name | Description | |
---|---|---|
AddHandler | (Inherited from UIElement.) | |
ApplyTemplate | (Inherited from Control.) | |
Arrange | (Inherited from UIElement.) | |
ArrangeOverride | (Inherited from FrameworkElement.) | |
CancelLoad | Cancels the current data loading operation performed by this DomainDataSource, if any. | |
CancelSubmit | Cancels the current submit operation performed by this DomainDataSource, if any. | |
CaptureMouse | (Inherited from UIElement.) | |
CheckAccess | (Inherited from DependencyObject.) | |
Clear | Clears all data from the DomainDataSource and the underlying EntitySet on the DomainContext. | |
ClearValue | (Inherited from DependencyObject.) | |
DeferLoad | Used to group multiple data loading operations into a single load operation. | |
Equals | (Inherited from Object.) | |
Finalize | (Inherited from Object.) | |
FindName | (Inherited from FrameworkElement.) | |
Focus | (Inherited from Control.) | |
GetAnimationBaseValue | (Inherited from DependencyObject.) | |
GetBindingExpression | (Inherited from FrameworkElement.) | |
GetHashCode | (Inherited from Object.) | |
GetTemplateChild | (Inherited from Control.) | |
GetType | (Inherited from Object.) | |
GetValue | (Inherited from DependencyObject.) | |
InvalidateArrange | (Inherited from UIElement.) | |
InvalidateMeasure | (Inherited from UIElement.) | |
Load | Starts a synchronous data loading operation. | |
Measure | (Inherited from UIElement.) | |
MeasureOverride | (Inherited from FrameworkElement.) | |
MemberwiseClone | (Inherited from Object.) | |
OnApplyTemplate | Builds the visual tree for the DomainDataSource when a new template is applied. (Overrides FrameworkElement.OnApplyTemplate().) | |
OnCreateAutomationPeer | (Inherited from UIElement.) | |
OnDoubleTap | (Inherited from Control.) | |
OnDragEnter | (Inherited from Control.) | |
OnDragLeave | (Inherited from Control.) | |
OnDragOver | (Inherited from Control.) | |
OnDrop | (Inherited from Control.) | |
OnGotFocus | (Inherited from Control.) | |
OnHold | (Inherited from Control.) | |
OnKeyDown | (Inherited from Control.) | |
OnKeyUp | (Inherited from Control.) | |
OnLostFocus | (Inherited from Control.) | |
OnLostMouseCapture | (Inherited from Control.) | |
OnManipulationCompleted | (Inherited from Control.) | |
OnManipulationDelta | (Inherited from Control.) | |
OnManipulationStarted | (Inherited from Control.) | |
OnMouseEnter | (Inherited from Control.) | |
OnMouseLeave | (Inherited from Control.) | |
OnMouseLeftButtonDown | (Inherited from Control.) | |
OnMouseLeftButtonUp | (Inherited from Control.) | |
OnMouseMove | (Inherited from Control.) | |
OnMouseRightButtonDown | (Inherited from Control.) | |
OnMouseRightButtonUp | (Inherited from Control.) | |
OnMouseWheel | (Inherited from Control.) | |
OnTap | (Inherited from Control.) | |
OnTextInput | (Inherited from Control.) | |
OnTextInputStart | (Inherited from Control.) | |
OnTextInputUpdate | (Inherited from Control.) | |
ReadLocalValue | (Inherited from DependencyObject.) | |
RejectChanges | Cancels the data changes that were performed by the underlying DomainContext. | |
ReleaseMouseCapture | (Inherited from UIElement.) | |
RemoveHandler | (Inherited from UIElement.) | |
SetBinding | (Inherited from FrameworkElement.) | |
SetValue | (Inherited from DependencyObject.) | |
SubmitChanges | Submits the changes for every Entity in the DomainContext. | |
ToString | (Inherited from Object.) | |
TransformToVisual | (Inherited from UIElement.) | |
UpdateLayout | (Inherited from UIElement.) |
Top
Events
Name | Description | |
---|---|---|
BindingValidationError | (Inherited from FrameworkElement.) | |
DoubleTap | (Inherited from UIElement.) | |
GotFocus | (Inherited from UIElement.) | |
Hold | (Inherited from UIElement.) | |
IsEnabledChanged | (Inherited from Control.) | |
KeyDown | (Inherited from UIElement.) | |
KeyUp | (Inherited from UIElement.) | |
LayoutUpdated | (Inherited from FrameworkElement.) | |
Loaded | (Inherited from FrameworkElement.) | |
LoadedData | Occurs when a data loading operation is completed. | |
LoadingData | Occurs when a data loading operation is started. | |
LostFocus | (Inherited from UIElement.) | |
LostMouseCapture | (Inherited from UIElement.) | |
ManipulationCompleted | (Inherited from UIElement.) | |
ManipulationDelta | (Inherited from UIElement.) | |
ManipulationStarted | (Inherited from UIElement.) | |
MouseEnter | (Inherited from UIElement.) | |
MouseLeave | (Inherited from UIElement.) | |
MouseLeftButtonDown | (Inherited from UIElement.) | |
MouseLeftButtonUp | (Inherited from UIElement.) | |
MouseMove | (Inherited from UIElement.) | |
MouseWheel | (Inherited from UIElement.) | |
SizeChanged | (Inherited from FrameworkElement.) | |
SubmittedChanges | Occurs whenever a submit operation is completed. | |
SubmittingChanges | Occurs whenever a submit operation is started. | |
Tap | (Inherited from UIElement.) | |
TextInput | (Inherited from UIElement.) | |
TextInputStart | (Inherited from UIElement.) | |
TextInputUpdate | (Inherited from UIElement.) | |
Unloaded | (Inherited from FrameworkElement.) |
Top
Fields
Name | Description | |
---|---|---|
AutoLoadProperty | Identifies the AutoLoad dependency property. | |
CanLoadProperty | Identifies the CancelLoad dependency property. | |
DataProperty | Identifies the Data dependency property. | |
DataViewProperty | Identifies the DataView dependency property. | |
DesignDataProperty | Identifies the DesignData dependency property. | |
DomainContextProperty | Identifies the DomainContext dependency property. | |
FilterOperatorProperty | Identifies the FilterOperator dependency property. | |
HasChangesProperty | Identifies the HasChanges dependency property. | |
IsBusyProperty | Identifies the IsBusy dependency property. | |
IsLoadingDataProperty | Identifies the IsLoadingData dependency property. | |
IsSubmittingChangesProperty | Identifies the IsSubmittingChanges dependency property. | |
LoadDelayProperty | Identifies the LoadDelay dependency property. | |
LoadIntervalProperty | Identifies the LoadInterval dependency property. | |
LoadSizeProperty | Identifies the LoadSize dependency property. | |
PageSizeProperty | Identifies the PageSize dependency property. | |
QueryNameProperty | Identifies the QueryName dependency property. | |
RefreshIntervalProperty | Identifies the RefreshInterval dependency property. |
Top
Remarks
Use this component to simplify the interaction between the user interface and data from a DomainContext. After specifying a DomainContext and QueryName, the DomainDataSource can load data and expose it through the Data and DataView properties.
For more information, see DomainDataSource.
Examples
The following example shows a DomainDataSource that retrieves data from a domain context named ProductDomainContext and displays the data in a DataGrid control. A query method called GetProducts() must exist on the domain service for the example to work. The DomainDataSource includes two filter descriptors that are connected by a logical AND statement. One filter depends on user input and one filter is specified in the declarative syntax.
<Grid x:Name="LayoutRoot" Background="White">
<Grid.RowDefinitions>
<RowDefinition Height="25" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<riaControls:DomainDataSource x:Name="source" QueryName="GetProducts" AutoLoad="true">
<riaControls:DomainDataSource.DomainContext>
<domain:ProductDomainContext />
</riaControls:DomainDataSource.DomainContext>
<riaControls:DomainDataSource.FilterDescriptors>
<riaData:FilterDescriptorCollection LogicalOperator="And">
<riaData:FilterDescriptor PropertyPath="Color" Operator="IsEqualTo" Value="Blue" />
<riaData:FilterDescriptor PropertyPath="ListPrice" Operator="IsLessThanOrEqualTo">
<riaControls:ControlParameter
ControlName="MaxPrice"
PropertyName="SelectedItem.Content"
RefreshEventName="SelectionChanged" />
</riaData:FilterDescriptor>
</riaData:FilterDescriptorCollection>
</riaControls:DomainDataSource.FilterDescriptors>
</riaControls:DomainDataSource>
<ComboBox x:Name="MaxPrice" Grid.Row="0" Width="60" SelectedIndex="0">
<ComboBoxItem Content="100" />
<ComboBoxItem Content="500" />
<ComboBoxItem Content="1000" />
</ComboBox>
<data:DataGrid Grid.Row="1" ItemsSource="{Binding Data, ElementName=source}" />
</Grid>
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.