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
Public method DomainDataSource Initializes a new instance of the DomainDataSource class.

Top

Properties

  Name Description
Public property ActualHeight (Inherited from FrameworkElement.)
Public property ActualWidth (Inherited from FrameworkElement.)
Public property AllowDrop (Inherited from UIElement.)
Public property AutoLoad Gets or sets a value indicating whether Load is automatically invoked when a change occurs that impacts the query composed by the DomainDataSource.
Public property Background (Inherited from Control.)
Public property BorderBrush (Inherited from Control.)
Public property BorderThickness (Inherited from Control.)
Public property CacheMode (Inherited from UIElement.)
Public property CanLoad Gets a value indicating whether the control can perform a load operation based on the present state.
Public property Clip (Inherited from UIElement.)
Public property Cursor (Inherited from FrameworkElement.)
Public property Data Gets the entities resulting from the last load operation, as an IEnumerable.
Public property DataContext (Inherited from FrameworkElement.)
Public property DataView Gets the current view of entities resulting from the last load operation, using a DomainDataSourceView.
Protected property DefaultStyleKey (Inherited from Control.)
Public property DesignData Gets or sets the data to use at design time.
Public property DesiredSize (Inherited from UIElement.)
Public property Dispatcher (Inherited from DependencyObject.)
Public property DomainContext Gets or sets the DomainContext instance used for executing the load and submit operations.
Public property FilterDescriptors Gets the collection of FilterDescriptor objects used when performing loads.
Public property FilterOperator Gets or sets the logical operator used for combining FilterDescriptor objects in the filters collection.
Public property FlowDirection (Inherited from FrameworkElement.)
Public property FontFamily (Inherited from Control.)
Public property FontSize (Inherited from Control.)
Public property FontStretch (Inherited from Control.)
Public property FontStyle (Inherited from Control.)
Public property FontWeight (Inherited from Control.)
Public property Foreground (Inherited from Control.)
Public property GroupDescriptors Gets the collection of grouping objects that are used to organize the data into groups.
Public property HasChanges Gets a value indicating whether the items exposed by this DomainDataSource have pending changes.
Public property Height (Inherited from FrameworkElement.)
Public property HorizontalAlignment (Inherited from FrameworkElement.)
Public property HorizontalContentAlignment (Inherited from Control.)
Public property IsBusy Gets a value indicating whether this DomainDataSource is loading data or submitting changes.
Public property IsEnabled (Inherited from Control.)
Public property IsHitTestVisible (Inherited from UIElement.)
Public property IsLoadingData Gets a value indicating whether the DomainDataSource is currently loading data.
Public property IsSubmittingChanges Gets a value indicating whether the DomainDataSource is currently submitting changes as a result of a call to SubmitChanges.
Public property IsTabStop (Inherited from Control.)
Public property Language (Inherited from FrameworkElement.)
Public property LoadCommand Gets an ICommand that invokes Load on this DomainDataSource.
Public property LoadDelay Gets or sets the delay before an automatic data loading operation is started.
Public property LoadInterval Gets or sets the duration between two successive data loading operations in a progressive data loading scenario.
Public property 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.
Public property Margin (Inherited from FrameworkElement.)
Public property MaxHeight (Inherited from FrameworkElement.)
Public property MaxWidth (Inherited from FrameworkElement.)
Public property MinHeight (Inherited from FrameworkElement.)
Public property MinWidth (Inherited from FrameworkElement.)
Public property Name (Inherited from FrameworkElement.)
Public property Opacity (Inherited from UIElement.)
Public property OpacityMask (Inherited from UIElement.)
Public property Padding (Inherited from Control.)
Public property 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.
Public property Parent (Inherited from FrameworkElement.)
Public property Projection (Inherited from UIElement.)
Public property QueryName Gets or sets the name of the query to use for loading.
Public property QueryParameters Gets the collection of Parameter objects representing arguments of the EntityQuery<TEntity> method specified by the QueryName property.
Public 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.
Public property RejectChangesCommand Gets an ICommand that invokes RejectChanges on this DomainDataSource.
Public property RenderSize (Inherited from UIElement.)
Public property RenderTransform (Inherited from UIElement.)
Public property RenderTransformOrigin (Inherited from UIElement.)
Public property Resources (Inherited from FrameworkElement.)
Public property SortDescriptors Gets the collection of sort descriptor objects that are used to sort the data.
Public property Style (Inherited from FrameworkElement.)
Public property SubmitChangesCommand Gets an ICommand that invokes SubmitChanges on this DomainDataSource.
Public property TabIndex (Inherited from Control.)
Public property TabNavigation (Inherited from Control.)
Public property Tag (Inherited from FrameworkElement.)
Public property Template (Inherited from Control.)
Public property Triggers (Inherited from FrameworkElement.)
Public property UseLayoutRounding (Inherited from UIElement.)
Public property VerticalAlignment (Inherited from FrameworkElement.)
Public property VerticalContentAlignment (Inherited from Control.)
Public property Visibility (Inherited from UIElement.)
Public property Width (Inherited from FrameworkElement.)

Top

Methods

  Name Description
Public method AddHandler (Inherited from UIElement.)
Public method ApplyTemplate (Inherited from Control.)
Public method Arrange (Inherited from UIElement.)
Protected method ArrangeOverride (Inherited from FrameworkElement.)
Public method CancelLoad Cancels the current data loading operation performed by this DomainDataSource, if any.
Public method CancelSubmit Cancels the current submit operation performed by this DomainDataSource, if any.
Public method CaptureMouse (Inherited from UIElement.)
Public method CheckAccess (Inherited from DependencyObject.)
Public method Clear Clears all data from the DomainDataSource and the underlying EntitySet on the DomainContext.
Public method ClearValue (Inherited from DependencyObject.)
Public method DeferLoad Used to group multiple data loading operations into a single load operation.
Public method Equals (Inherited from Object.)
Protected method Finalize (Inherited from Object.)
Public method FindName (Inherited from FrameworkElement.)
Public method Focus (Inherited from Control.)
Public method GetAnimationBaseValue (Inherited from DependencyObject.)
Public method GetBindingExpression (Inherited from FrameworkElement.)
Public method GetHashCode (Inherited from Object.)
Protected method GetTemplateChild (Inherited from Control.)
Public method GetType (Inherited from Object.)
Public method GetValue (Inherited from DependencyObject.)
Public method InvalidateArrange (Inherited from UIElement.)
Public method InvalidateMeasure (Inherited from UIElement.)
Public method Load Starts a synchronous data loading operation.
Public method Measure (Inherited from UIElement.)
Protected method MeasureOverride (Inherited from FrameworkElement.)
Protected method MemberwiseClone (Inherited from Object.)
Public method OnApplyTemplate Builds the visual tree for the DomainDataSource when a new template is applied. (Overrides FrameworkElement.OnApplyTemplate().)
Protected method OnCreateAutomationPeer (Inherited from UIElement.)
Protected method OnDoubleTap (Inherited from Control.)
Protected method OnDragEnter (Inherited from Control.)
Protected method OnDragLeave (Inherited from Control.)
Protected method OnDragOver (Inherited from Control.)
Protected method OnDrop (Inherited from Control.)
Protected method OnGotFocus (Inherited from Control.)
Protected method OnHold (Inherited from Control.)
Protected method OnKeyDown (Inherited from Control.)
Protected method OnKeyUp (Inherited from Control.)
Protected method OnLostFocus (Inherited from Control.)
Protected method OnLostMouseCapture (Inherited from Control.)
Protected method OnManipulationCompleted (Inherited from Control.)
Protected method OnManipulationDelta (Inherited from Control.)
Protected method OnManipulationStarted (Inherited from Control.)
Protected method OnMouseEnter (Inherited from Control.)
Protected method OnMouseLeave (Inherited from Control.)
Protected method OnMouseLeftButtonDown (Inherited from Control.)
Protected method OnMouseLeftButtonUp (Inherited from Control.)
Protected method OnMouseMove (Inherited from Control.)
Protected method OnMouseRightButtonDown (Inherited from Control.)
Protected method OnMouseRightButtonUp (Inherited from Control.)
Protected method OnMouseWheel (Inherited from Control.)
Protected method OnTap (Inherited from Control.)
Protected method OnTextInput (Inherited from Control.)
Protected method OnTextInputStart (Inherited from Control.)
Protected method OnTextInputUpdate (Inherited from Control.)
Public method ReadLocalValue (Inherited from DependencyObject.)
Public method RejectChanges Cancels the data changes that were performed by the underlying DomainContext.
Public method ReleaseMouseCapture (Inherited from UIElement.)
Public method RemoveHandler (Inherited from UIElement.)
Public method SetBinding (Inherited from FrameworkElement.)
Public method SetValue (Inherited from DependencyObject.)
Public method SubmitChanges Submits the changes for every Entity in the DomainContext.
Public method ToString (Inherited from Object.)
Public method TransformToVisual (Inherited from UIElement.)
Public method UpdateLayout (Inherited from UIElement.)

Top

Events

  Name Description
Public event BindingValidationError (Inherited from FrameworkElement.)
Public event DoubleTap (Inherited from UIElement.)
Public event GotFocus (Inherited from UIElement.)
Public event Hold (Inherited from UIElement.)
Public event IsEnabledChanged (Inherited from Control.)
Public event KeyDown (Inherited from UIElement.)
Public event KeyUp (Inherited from UIElement.)
Public event LayoutUpdated (Inherited from FrameworkElement.)
Public event Loaded (Inherited from FrameworkElement.)
Public event LoadedData Occurs when a data loading operation is completed.
Public event LoadingData Occurs when a data loading operation is started.
Public event LostFocus (Inherited from UIElement.)
Public event LostMouseCapture (Inherited from UIElement.)
Public event ManipulationCompleted (Inherited from UIElement.)
Public event ManipulationDelta (Inherited from UIElement.)
Public event ManipulationStarted (Inherited from UIElement.)
Public event MouseEnter (Inherited from UIElement.)
Public event MouseLeave (Inherited from UIElement.)
Public event MouseLeftButtonDown (Inherited from UIElement.)
Public event MouseLeftButtonUp (Inherited from UIElement.)
Public event MouseMove (Inherited from UIElement.)
Public event MouseWheel (Inherited from UIElement.)
Public event SizeChanged (Inherited from FrameworkElement.)
Public event SubmittedChanges Occurs whenever a submit operation is completed.
Public event SubmittingChanges Occurs whenever a submit operation is started.
Public event Tap (Inherited from UIElement.)
Public event TextInput (Inherited from UIElement.)
Public event TextInputStart (Inherited from UIElement.)
Public event TextInputUpdate (Inherited from UIElement.)
Public event Unloaded (Inherited from FrameworkElement.)

Top

Fields

  Name Description
Public fieldStatic member AutoLoadProperty Identifies the AutoLoad dependency property.
Public fieldStatic member CanLoadProperty Identifies the CancelLoad dependency property.
Public fieldStatic member DataProperty Identifies the Data dependency property.
Public fieldStatic member DataViewProperty Identifies the DataView dependency property.
Public fieldStatic member DesignDataProperty Identifies the DesignData dependency property.
Public fieldStatic member DomainContextProperty Identifies the DomainContext dependency property.
Public fieldStatic member FilterOperatorProperty Identifies the FilterOperator dependency property.
Public fieldStatic member HasChangesProperty Identifies the HasChanges dependency property.
Public fieldStatic member IsBusyProperty Identifies the IsBusy dependency property.
Public fieldStatic member IsLoadingDataProperty Identifies the IsLoadingData dependency property.
Public fieldStatic member IsSubmittingChangesProperty Identifies the IsSubmittingChanges dependency property.
Public fieldStatic member LoadDelayProperty Identifies the LoadDelay dependency property.
Public fieldStatic member LoadIntervalProperty Identifies the LoadInterval dependency property.
Public fieldStatic member LoadSizeProperty Identifies the LoadSize dependency property.
Public fieldStatic member PageSizeProperty Identifies the PageSize dependency property.
Public fieldStatic member QueryNameProperty Identifies the QueryName dependency property.
Public fieldStatic member 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.

See Also

Reference

System.Windows.Controls Namespace