Duration (Pacific Standard Time):
To (Pacific Standard Time):
Impact:
  • None
User Action:
  • None

EntityCollectionChangedParams Class

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Encapsulates the arguments of a CollectionChanged delegate.

Namespace:   System.Data.Services.Client
Assembly:  System.Data.Services.Client (in System.Data.Services.Client.dll)

System.Object
  System.Data.Services.Client.EntityCollectionChangedParams

Public NotInheritable Class EntityCollectionChangedParams
Name Description
System_CAPS_pubproperty Action

A NotifyCollectionChangedAction value that indicates how the collection was changed.

System_CAPS_pubproperty Collection

The DataServiceCollection<T> that has changed.

System_CAPS_pubproperty Context

The DataServiceContext associated with the DataServiceCollection<T> that has changed.

System_CAPS_pubproperty PropertyName

The navigation property on the source object that references the collection that has changed.

System_CAPS_pubproperty SourceEntity

The source object that references the target object in the collection by using a navigation property.

System_CAPS_pubproperty SourceEntitySet

The entity set of the source object.

System_CAPS_pubproperty TargetEntity

The entity object in the collection that has changed.

System_CAPS_pubproperty TargetEntitySet

The entity set name of the object in the collection.

Name Description
System_CAPS_pubmethod Equals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethod GetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethod GetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethod ToString()

Returns a string that represents the current object.(Inherited from Object.)

The following code-behind page for the XAML file creates a DataServiceCollection<T> with custom methods that are called when changes occur to data that is bound to the binding collection. When the CollectionChanged event occurs, the supplied method prevents an item that has been removed from the binding collection from being deleted from the data service. When the PropertyChanged event occurs, the ShipDate value is validated to ensure that changes are not made to orders that have already shipped.

The following XAML code defines the window for the previous example.

<Window x:Class="CustomerOrdersCustom"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             Height="423" Width="679" Loaded="Window_Loaded" >
    <StackPanel Orientation="Vertical" Height="Auto" Name="LayoutRoot" Width="Auto">
        <Label Content="Customer ID" Margin="20,0,0,0" />
        <ComboBox Name="customerIDComboBox" DisplayMemberPath="CustomerID" ItemsSource="{Binding}" 
                  IsSynchronizedWithCurrentItem="True" SelectedIndex="0" Height="23" Width="120" 
                  HorizontalAlignment="Left" Margin="20,0,0,0" VerticalAlignment="Center" />
        <ListView ItemsSource="{Binding Path=Orders}" Name="ordersDataGrid" Margin="34,46,34,50">
            <ListView.View>
                <GridView AllowsColumnReorder="False" ColumnHeaderToolTip="Line Items">
                    <GridViewColumn DisplayMemberBinding="{Binding Path=OrderID, Mode=OneWay}" 
                        Header="Order ID" Width="50"/>
                    <GridViewColumn DisplayMemberBinding="{Binding Path=OrderDate, Mode=TwoWay}" 
                        Header="Order Date" Width="50"/>
                    <GridViewColumn DisplayMemberBinding="{Binding Path=Freight, Mode=TwoWay}" 
                        Header="Freight Cost" Width="50"/>
                </GridView>
            </ListView.View>
        </ListView>
        <StackPanel Orientation="Horizontal">
            <Button Name="deleteButton" Content="Delete Order" Click="deleteButton_Click" 
                Width="80" Height="30" Margin="450,0,10,0"/>
            <Button Name="saveChangesButton" Content="Save Changes" Click="saveChangesButton_Click" 
                Width="80" Height="30" Margin="10,0,0,0"/>
        </StackPanel>
    </StackPanel>
</Window>
.NET Framework
Available since 3.5
Silverlight
Available since 4.0

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top