BindingGroup BindingGroup BindingGroup BindingGroup Class

定義

內含用來驗證物件之繫結和 ValidationRule 物件的集合。Contains a collection of bindings and ValidationRule objects that are used to validate an object.

public ref class BindingGroup : System::Windows::DependencyObject
public class BindingGroup : System.Windows.DependencyObject
type BindingGroup = class
    inherit DependencyObject
Public Class BindingGroup
Inherits DependencyObject
繼承

範例

下列範例會建立應用程式會提示使用者輸入的描述和價格項目和供應項目到期的日期。The following examples create an application that prompts the user to enter the description and price of an item and the date that the offer expires. 應用程式會顯示在表單下方的項目目前的資訊。The application displays the current information for the item below the form. 使用者可以提交,或取消所做的變更。The user can submit or cancel the changes.

應用程式會執行下列命令來達成此行為。The application does the following to achieve this behavior.

  • 會建立BindingGroup並將它加入根StackPanel當它建立使用者介面 (UI)user interface (UI)應用程式。Creates a BindingGroup and adds it the root StackPanel when it creates the 使用者介面 (UI)user interface (UI) of the application.

  • 呼叫BeginEditCommitEdit,和CancelEdit若要啟用的應用程式的邏輯中回復變更。Calls BeginEdit, CommitEdit, and CancelEdit in the application's logic to enable rolling back changes.

  • 呼叫TryGetValueValidate方法來取得使用者的輸入,然後檢查 透過 100 元的項目可在至少 7 天。Calls TryGetValue in a Validate method to get the user's input and then check that an item over 100 dollars is available for at least seven days.

下列範例會建立使用者介面 (UI)user interface (UI)應用程式。The following example creates the 使用者介面 (UI)user interface (UI) of the application. 根目錄StackPanel已經BindingGroup包含ValidationRule來驗證項目,如先前所述。The root StackPanel has a BindingGroup that contains a ValidationRule that validates the item, as described previously. 上的繫結物件Price屬性和OfferExpires屬性會變成一部分BindingGroup每個繫結,且ValidationRule藉此確定價格和日期,分別是有效的值。The binding objects on the Price property and the OfferExpires property become part of the BindingGroup and each binding has a ValidationRule to make sure that price and date, respectively, are valid values. 之前執行的個別屬性的驗證規則ValidationRuleBindingGroupThe validation rules for the individual properties run before the ValidationRule on the BindingGroup.

<StackPanel Name="stackPanel1"  Margin="10" Width="250"
            Loaded="stackPanel1_Loaded"
            Validation.Error="ItemError">

  <StackPanel.Resources>
    <Style TargetType="HeaderedContentControl">
      <Setter Property="Margin" Value="2"/>
      <Setter Property="Focusable" Value="False"/>
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="HeaderedContentControl">
            <DockPanel LastChildFill="False">
              <ContentPresenter ContentSource="Header" DockPanel.Dock="Left" Focusable="False" VerticalAlignment="Center"/>
              <ContentPresenter ContentSource="Content" Margin="5,0,0,0" DockPanel.Dock="Right" VerticalAlignment="Center"/>
            </DockPanel>

          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>

    <Style TargetType="Button">
      <Setter Property="Width" Value="100"/>
      <Setter Property="Margin" Value="10,15,15,15"/>

    </Style>

  </StackPanel.Resources>
  
  <StackPanel.BindingGroup>
    <BindingGroup NotifyOnValidationError="True">
      <BindingGroup.ValidationRules>
        <src:ValidateDateAndPrice ValidationStep="ConvertedProposedValue" />
      </BindingGroup.ValidationRules>
    </BindingGroup>
  </StackPanel.BindingGroup>
  
  <TextBlock FontSize="14" Text="Enter an item for sale"/>
  <HeaderedContentControl Header="Description">
    <TextBox Width="150" Text="{Binding Path=Description, Mode=TwoWay}"/>
  </HeaderedContentControl>
  <HeaderedContentControl Header="Price">
    <TextBox Name="priceField"  Width="150">
      <TextBox.Text>
        <Binding Path="Price" Mode="TwoWay" >
          <Binding.ValidationRules>
            <src:PriceIsAPositiveNumber/>
          </Binding.ValidationRules>
        </Binding>
      </TextBox.Text>
    </TextBox>
  </HeaderedContentControl>
  <HeaderedContentControl Header="Date Offer Ends">
    <TextBox Name="dateField" Width="150" >
      <TextBox.Text>
        <Binding Path="OfferExpires" StringFormat="d" >
          <Binding.ValidationRules>
            <src:FutureDateRule/>
          </Binding.ValidationRules>
        </Binding>
      </TextBox.Text>
    </TextBox>
  </HeaderedContentControl>
  <StackPanel Orientation="Horizontal">
    <Button IsDefault="True" Click="Submit_Click">_Submit</Button>
    <Button IsCancel="True" Click="Cancel_Click">_Cancel</Button>
  </StackPanel>
  <HeaderedContentControl Header="Description">
    <TextBlock Width="150" Text="{Binding Path=Description}"/>
  </HeaderedContentControl>
  <HeaderedContentControl Header="Price">
    <TextBlock Width="150" Text="{Binding Path=Price, StringFormat=c}"/>
  </HeaderedContentControl>
  <HeaderedContentControl Header="Date Offer Ends">
    <TextBlock Width="150" Text="{Binding Path=OfferExpires, StringFormat=d}"/>
  </HeaderedContentControl>
</StackPanel>

下列範例會示範應用程式的事件處理常式。The following example shows the event handlers for the application. 當使用者按一下 [提交] 按鈕時,應用程式會呼叫CommitEdit逐一執行這ValidationRule相關聯BindingGroupWhen the user clicks the Submit button, the application calls CommitEdit to run each ValidationRule that is associated with the BindingGroup. 如果每個ValidationRule成功,CommitEdit將值儲存至物件,並結束編輯異動。If each ValidationRule succeeds, CommitEdit saves the values to the object and ends the edit transaction. 如果CommitEdit會成功,應用程式開始另一個編輯異動。If CommitEdit is successful, the application begins another edit transaction. ValidationRule失敗,請Validation.Error因為應用程式設定,就會發生事件NotifyOnValidationErrortrueBindingGroup(在上述範例中)。When a ValidationRule fails, the Validation.Error event occurs because the application set NotifyOnValidationError to true on the BindingGroup (in the previous example). ItemError 控制代碼Validation.Error事件,並顯示給使用者的驗證錯誤的相關資訊。ItemError handles the Validation.Error event and displays information about the validation error to the user. 此範例也會處理Loaded事件StackPanelClick事件取消 按鈕。The example also handles the Loaded event for the StackPanel and the Click event for the Cancel button.


private void Submit_Click(object sender, RoutedEventArgs e)
{
    if (stackPanel1.BindingGroup.CommitEdit())
    {
        MessageBox.Show("Item submitted");
        stackPanel1.BindingGroup.BeginEdit();
    }

    
}

// This event occurs when a ValidationRule in the BindingGroup
// or in a Binding fails.
private void ItemError(object sender, ValidationErrorEventArgs e)
{
    if (e.Action == ValidationErrorEventAction.Added)
    {
        MessageBox.Show(e.Error.ErrorContent.ToString());

    }
}

void stackPanel1_Loaded(object sender, RoutedEventArgs e)
{
    // Set the DataContext to a PurchaseItem object.
    // The BindingGroup and Binding objects use this as
    // the source.
    stackPanel1.DataContext = new PurchaseItem();

    // Begin an edit transaction that enables
    // the object to accept or roll back changes.
    stackPanel1.BindingGroup.BeginEdit();
}

private void Cancel_Click(object sender, RoutedEventArgs e)
{
    // Cancel the pending changes and begin a new edit transaction.
    stackPanel1.BindingGroup.CancelEdit();
    stackPanel1.BindingGroup.BeginEdit();
}


Private Sub Submit_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
	If stackPanel1.BindingGroup.CommitEdit() Then
		MessageBox.Show("Item submitted")
		stackPanel1.BindingGroup.BeginEdit()
	End If


End Sub

' This event occurs when a ValidationRule in the BindingGroup
' or in a Binding fails.
Private Sub ItemError(ByVal sender As Object, ByVal e As ValidationErrorEventArgs)
	If e.Action = ValidationErrorEventAction.Added Then
		MessageBox.Show(e.Error.ErrorContent.ToString())

	End If
End Sub

Private Sub stackPanel1_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
	' Set the DataContext to a PurchaseItem object.
	' The BindingGroup and Binding objects use this as
	' the source.
	stackPanel1.DataContext = New PurchaseItem()

	' Begin an edit transaction that enables
	' the object to accept or roll back changes.
	stackPanel1.BindingGroup.BeginEdit()
End Sub

Private Sub Cancel_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
	' Cancel the pending changes and begin a new edit transaction.
	stackPanel1.BindingGroup.CancelEdit()
	stackPanel1.BindingGroup.BeginEdit()
End Sub

下列範例顯示的自訂ValidationRule ValidateDateAndPrice,已加入BindingGroup中第一個範例。The following example shows the custom ValidationRule ValidateDateAndPrice, which was added to the BindingGroup in the first example. ValidationRule會使用BindingGroup在其Validate方法來取得使用者輸入表單,並檢查,如果項目超過 $100 元即可,它可在至少 7 天的值。The ValidationRule uses the BindingGroup in its Validate method to get the values the user entered into the form, and checks that if an item is over 100 dollars, it will be available for at least seven days.

public class ValidateDateAndPrice : ValidationRule
{
    // Ensure that an item over $100 is available for at least 7 days.
    public override ValidationResult Validate(object value, CultureInfo cultureInfo)
    {
        BindingGroup bg = value as BindingGroup;

        // Get the source object.
        PurchaseItem item = bg.Items[0] as PurchaseItem;
        
        object doubleValue;
        object dateTimeValue;

        // Get the proposed values for Price and OfferExpires.
        bool priceResult = bg.TryGetValue(item, "Price", out doubleValue);
        bool dateResult = bg.TryGetValue(item, "OfferExpires", out dateTimeValue);

        if (!priceResult || !dateResult)
        {
            return new ValidationResult(false, "Properties not found");
        }

        double price = (double)doubleValue;
        DateTime offerExpires = (DateTime)dateTimeValue;

        // Check that an item over $100 is available for at least 7 days.
        if (price > 100)
        {
            if (offerExpires < DateTime.Today + new TimeSpan(7, 0, 0, 0))
            {
                return new ValidationResult(false, "Items over $100 must be available for at least 7 days.");
            }
        }

        return ValidationResult.ValidResult;

    }
}
Public Class ValidateDateAndPrice
	Inherits ValidationRule
	' Ensure that an item over $100 is available for at least 7 days.
	Public Overrides Function Validate(ByVal value As Object, ByVal cultureInfo As CultureInfo) As ValidationResult
		Dim bg As BindingGroup = TryCast(value, BindingGroup)

		' Get the source object.
		Dim item As PurchaseItem = TryCast(bg.Items(0), PurchaseItem)

           Dim doubleValue As Object = Nothing
           Dim dateTimeValue As Object = Nothing

		' Get the proposed values for Price and OfferExpires.
		Dim priceResult As Boolean = bg.TryGetValue(item, "Price", doubleValue)
		Dim dateResult As Boolean = bg.TryGetValue(item, "OfferExpires", dateTimeValue)

		If (Not priceResult) OrElse (Not dateResult) Then
			Return New ValidationResult(False, "Properties not found")
		End If

		Dim price As Double = CDbl(doubleValue)
		Dim offerExpires As Date = CDate(dateTimeValue)

		' Check that an item over $100 is available for at least 7 days.
		If price > 100 Then
			If offerExpires < Date.Today + New TimeSpan(7, 0, 0, 0) Then
				Return New ValidationResult(False, "Items over $100 must be available for at least 7 days.")
			End If
		End If

		Return ValidationResult.ValidResult

	End Function
End Class

備註

ABindingGroup建立多個繫結,會進行驗證並同時更新之間的關聯性。A BindingGroup creates a relationship between multiple bindings, which can be validated and updated together. 例如,假設應用程式會提示使用者輸入的位址。For example, suppose that an application prompts the user to enter an address. 接著,應用程式填入物件的型別Address,其中具有屬性, StreetCityZipCode,和Country,使用者提供的值。The application then populates an object of type Address, which has the properties, Street, City, ZipCode, and Country, with the values that the user provided. 應用程式必須包含四個面板TextBox控制項,每個都是資料繫結至其中一個物件的屬性。The application has a panel that contains four TextBox controls, each of which is data bound to one of the object's properties. 您可以使用ValidationRuleBindingGroup驗證Address物件。You can use a ValidationRule in a BindingGroup to validate the Address object. 如果繫結參與相同BindingGroup,您可以確保 zip 程式碼是有效的國家/地區的地址。If the bindings participate in the same BindingGroup, you can ensure that the zip-code is valid for the country/region of the address.

您設定BindingGroup上的屬性FrameworkElementFrameworkContentElementYou set the BindingGroup property on FrameworkElement or FrameworkContentElement. 項目子系繼承BindingGroup從其父項目,就如同任何其他可繼承的屬性。Child elements inherit the BindingGroup from their parent elements, just as with any other inheritable property. 繫結的子系的項目新增至BindingGroup發生下列情況的其中一個:A binding on a descendent element is added to a BindingGroup if one of the following situations occurs:

在位址的範例中,假設DataContextPanel設定為型別的物件AddressIn the example of the address, suppose that the DataContext of the Panel is set to the object of type Address. 每個繫結TextBox新增至BindingGroup 面板。The binding for each TextBox is added to the BindingGroup of the panel.

您將新增ValidationRule物件至BindingGroupYou add ValidationRule objects to a BindingGroup. BindingGroup的第一個參數當做傳遞Validate方法時ValidationRule執行。The BindingGroup is passed as the first parameter of the Validate method when the ValidationRule runs. 您可以使用TryGetValueGetValue(Object, String)上的方法BindingGroup以取得建議的值的物件,而Items屬性取得繫結來源。You can use the TryGetValue or GetValue(Object, String) method on that BindingGroup to get the proposed values of the object, and the Items property to get the sources of the bindings.

ABindingGroup更新在相同的時間,而不是個別更新每個繫結的繫結的來源。A BindingGroup updates the sources of the binding at the same time instead of each binding being updated separately. 當您呼叫其中一個方法來驗證資料 (ValidateWithoutUpdateUpdateSources,或CommitEdit),每個繫結TextBox在此範例會進行驗證,並可能進行更新。When you call one of the methods to validate the data (ValidateWithoutUpdate, UpdateSources, or CommitEdit), the binding for each TextBox in the example is validated and potentially updated. 繫結時的一部分BindingGroup,直到您呼叫不會更新繫結來源UpdateSources或是CommitEditBindingGroup,除非您明確設定UpdateSourceTrigger屬性。When a binding is part of a BindingGroup, the source of the binding is not updated until you call UpdateSources or CommitEdit on the BindingGroup, unless you explicitly set the UpdateSourceTrigger property.

建構函式

BindingGroup() BindingGroup() BindingGroup() BindingGroup()

初始化 BindingGroup 類別的新執行個體。Initializes a new instance of the BindingGroup class.

屬性

BindingExpressions BindingExpressions BindingExpressions BindingExpressions

取得 BindingExpression 物件的集合,這類物件包含 BindingGroup 中各個繫結的資訊。Gets a collection of BindingExpression objects that contains information for each Binding in the BindingGroup.

CanRestoreValues CanRestoreValues CanRestoreValues CanRestoreValues

取得值,這個值表示繫結中的每一個來源是否可以捨棄暫止的變更並還原為原始值。Gets whether each source in the binding can discard pending changes and restore the original values.

DependencyObjectType DependencyObjectType DependencyObjectType DependencyObjectType

取得包裝此執行個體之 CLRCLR 型別的 DependencyObjectTypeGets the DependencyObjectType that wraps the CLRCLR type of this instance.

(Inherited from DependencyObject)
Dispatcher Dispatcher Dispatcher Dispatcher

取得DispatcherDispatcherObject相關聯。Gets the Dispatcher this DispatcherObject is associated with.

(Inherited from DispatcherObject)
HasValidationError HasValidationError HasValidationError HasValidationError

取得值,指出 BindingGroup 是否擁有失敗的驗證規則。Gets a value that indicates whether the BindingGroup has a failed validation rule.

IsDirty IsDirty IsDirty IsDirty

取得或設定值,指出 BindingGroup 是否含有尚未寫入至來源的建議值。Gets or sets a value that indicates whether the BindingGroup contains a proposed value that has not been written to the source.

IsSealed IsSealed IsSealed IsSealed

取得值,這個值表示此執行個體目前是否已密封 (唯讀)。Gets a value that indicates whether this instance is currently sealed (read-only).

(Inherited from DependencyObject)
Items Items Items Items

取得 BindingGroup 中之 Binding 物件所使用的來源。Gets the sources that are used by the Binding objects in the BindingGroup.

Name Name Name Name

取得或設定名稱,這個名稱會識別用來包含和排除 BindingGroup 中 Binding 物件的 BindingGroupGets or sets the name that identifies the BindingGroup, which can be used to include and exclude Binding objects in the BindingGroup.

NotifyOnValidationError NotifyOnValidationError NotifyOnValidationError NotifyOnValidationError

取得或設定值,這個值會表示當 Error 的狀態變更時,是否會發生 ValidationRule 事件。Gets or sets whether the Error event occurs when the state of a ValidationRule changes.

Owner Owner Owner Owner

取得被指派這個 BindingGroup 的物件。Gets the object that this BindingGroup is assigned to.

SharesProposedValues SharesProposedValues SharesProposedValues SharesProposedValues

取得或設定值,這個值指出 BindingGroup 是否重複使用尚未認可至來源的目標值。Gets or sets a value that indicates whether the BindingGroup reuses target values that have not been committed to the source.

ValidatesOnNotifyDataError ValidatesOnNotifyDataError ValidatesOnNotifyDataError ValidatesOnNotifyDataError

取得或設定值,這個值表示是否要包含 NotifyDataErrorValidationRuleGets or sets a value that indicates whether to include the NotifyDataErrorValidationRule.

ValidationErrors ValidationErrors ValidationErrors ValidationErrors

取得導致 ValidationError 無效之 BindingGroup 物件的集合。Gets a collection of ValidationError objects that caused the BindingGroup to be invalid.

ValidationRules ValidationRules ValidationRules ValidationRules

取得 ValidationRule 物件的集合,這些物件會驗證 BindingGroup 中的來源物件。Gets a collection of ValidationRule objects that validate the source objects in the BindingGroup.

方法

BeginEdit() BeginEdit() BeginEdit() BeginEdit()

開始對 BindingGroup 中的來源,進行編輯異動。Begins an edit transaction on the sources in the BindingGroup.

CancelEdit() CancelEdit() CancelEdit() CancelEdit()

結束編輯異動並捨棄暫止的變更。Ends the edit transaction and discards the pending changes.

CheckAccess() CheckAccess() CheckAccess() CheckAccess()

判斷呼叫的執行緒是否可以存取這個DispatcherObjectDetermines whether the calling thread has access to this DispatcherObject.

(Inherited from DispatcherObject)
ClearValue(DependencyProperty) ClearValue(DependencyProperty) ClearValue(DependencyProperty) ClearValue(DependencyProperty)

清除屬性的區域數值。Clears the local value of a property. 要清除的屬性是由 DependencyProperty 識別項所指定。The property to be cleared is specified by a DependencyProperty identifier.

(Inherited from DependencyObject)
ClearValue(DependencyPropertyKey) ClearValue(DependencyPropertyKey) ClearValue(DependencyPropertyKey) ClearValue(DependencyPropertyKey)

清除唯讀屬性的區域數值。Clears the local value of a read-only property. 要清除的屬性是由 DependencyPropertyKey 所指定。The property to be cleared is specified by a DependencyPropertyKey.

(Inherited from DependencyObject)
CoerceValue(DependencyProperty) CoerceValue(DependencyProperty) CoerceValue(DependencyProperty) CoerceValue(DependencyProperty)

強制轉型所指定相依性屬性的值。Coerces the value of the specified dependency property. 叫用存在於呼叫 CoerceValueCallback 上相依性屬性之屬性中繼資料內所指定的任何 DependencyObject 函式,就可以達到這一點。This is accomplished by invoking any CoerceValueCallback function specified in property metadata for the dependency property as it exists on the calling DependencyObject.

(Inherited from DependencyObject)
CommitEdit() CommitEdit() CommitEdit() CommitEdit()

如果所有驗證規則都成功,這個方法會執行所有的 ValidationRule 物件,並更新繫結來源。Runs all the ValidationRule objects and updates the binding sources if all validation rules succeed.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷提供的 DependencyObject 和目前的 DependencyObject 是否相等。Determines whether a provided DependencyObject is equivalent to the current DependencyObject.

(Inherited from DependencyObject)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

取得這個 DependencyObject 的雜湊程式碼。Gets a hash code for this DependencyObject.

(Inherited from DependencyObject)
GetLocalValueEnumerator() GetLocalValueEnumerator() GetLocalValueEnumerator() GetLocalValueEnumerator()

建立特定的列舉值,以判斷哪些相依性屬性在此 DependencyObject 上具有本機設定的值。Creates a specialized enumerator for determining which dependency properties have locally set values on this DependencyObject.

(Inherited from DependencyObject)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
GetValue(DependencyProperty) GetValue(DependencyProperty) GetValue(DependencyProperty) GetValue(DependencyProperty)

傳回 DependencyObject 的這個執行個體上之相依性屬性的目前有效值。Returns the current effective value of a dependency property on this instance of a DependencyObject.

(Inherited from DependencyObject)
GetValue(Object, String) GetValue(Object, String) GetValue(Object, String) GetValue(Object, String)

傳回指定之屬性與項目的建議值。Returns the proposed value for the specified property and item.

InvalidateProperty(DependencyProperty) InvalidateProperty(DependencyProperty) InvalidateProperty(DependencyProperty) InvalidateProperty(DependencyProperty)

重新評估指定之相依性屬性的有效值。Re-evaluates the effective value for the specified dependency property

(Inherited from DependencyObject)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
OnPropertyChanged(DependencyPropertyChangedEventArgs) OnPropertyChanged(DependencyPropertyChangedEventArgs) OnPropertyChanged(DependencyPropertyChangedEventArgs) OnPropertyChanged(DependencyPropertyChangedEventArgs)

每當這個 DependencyObject 上任何相依性屬性的有效值已更新時叫用。Invoked whenever the effective value of any dependency property on this DependencyObject has been updated. 已變更的特定相依性屬性會在事件資料中報告。The specific dependency property that changed is reported in the event data.

(Inherited from DependencyObject)
ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty) ReadLocalValue(DependencyProperty)

傳回相依性屬性的區域值 (如果存在)。Returns the local value of a dependency property, if it exists.

(Inherited from DependencyObject)
SetCurrentValue(DependencyProperty, Object) SetCurrentValue(DependencyProperty, Object) SetCurrentValue(DependencyProperty, Object) SetCurrentValue(DependencyProperty, Object)

設定相依性屬性的值,而不需要變更其值來源。Sets the value of a dependency property without changing its value source.

(Inherited from DependencyObject)
SetValue(DependencyProperty, Object) SetValue(DependencyProperty, Object) SetValue(DependencyProperty, Object) SetValue(DependencyProperty, Object)

設定相依性屬性的區域值 (由相依性屬性的識別碼所指定)。Sets the local value of a dependency property, specified by its dependency property identifier.

(Inherited from DependencyObject)
SetValue(DependencyPropertyKey, Object) SetValue(DependencyPropertyKey, Object) SetValue(DependencyPropertyKey, Object) SetValue(DependencyPropertyKey, Object)

設定唯讀相依性屬性的區域數值 (由相依性屬性的 DependencyPropertyKey 識別項所指定)。Sets the local value of a read-only dependency property, specified by the DependencyPropertyKey identifier of the dependency property.

(Inherited from DependencyObject)
ShouldSerializeProperty(DependencyProperty) ShouldSerializeProperty(DependencyProperty) ShouldSerializeProperty(DependencyProperty) ShouldSerializeProperty(DependencyProperty)

傳回值,這個值表示序列化程序是否應該序列化所提供相依性屬性的值。Returns a value that indicates whether serialization processes should serialize the value for the provided dependency property.

(Inherited from DependencyObject)
ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)
TryGetValue(Object, String, Object) TryGetValue(Object, String, Object) TryGetValue(Object, String, Object) TryGetValue(Object, String, Object)

嘗試取得指定之屬性與項目的建議值。Attempts to get the proposed value for the specified property and item.

UpdateSources() UpdateSources() UpdateSources() UpdateSources()

如果所有驗證規則都成功,則會對此繫結和屬性 ValidationRule 設定為 ValidationStepRawProposedValueConvertedProposedValueUpdatedValue 物件執行該轉換子,並將目標值儲存至來源物件。Runs the converter on the binding and the ValidationRule objects that have the ValidationStep property set to RawProposedValue, ConvertedProposedValue, or UpdatedValue and saves the values of the targets to the source objects if all the validation rules succeed.

ValidateWithoutUpdate() ValidateWithoutUpdate() ValidateWithoutUpdate() ValidateWithoutUpdate()

對此繫結和屬性 ValidationRule 設定為 ValidationStepRawProposedValueConvertedProposedValue 物件執行轉換子。Runs the converter on the binding and the ValidationRule objects that have the ValidationStep property set to RawProposedValue or ConvertedProposedValue.

VerifyAccess() VerifyAccess() VerifyAccess() VerifyAccess()

強制執行呼叫的執行緒可以存取這個DispatcherObjectEnforces that the calling thread has access to this DispatcherObject.

(Inherited from DispatcherObject)

適用於