ObjectDataProvider.ConstructorParameters Propriété

Définition

Obtient que la liste de paramètres passe au constructeur.

public:
 property System::Collections::IList ^ ConstructorParameters { System::Collections::IList ^ get(); };
public System.Collections.IList ConstructorParameters { get; }
member this.ConstructorParameters : System.Collections.IList
Public ReadOnly Property ConstructorParameters As IList

Valeur de propriété

IList

Liste de paramètres à passer au constructeur. La valeur par défaut est null.

Exemples

Les lignes mises en surbrillance dans l’exemple suivant utilisent un ObjectDataProvider wrapper comme wrapper pour un Person objet. L’élément <ObjectDataProvider.ConstructorParameters> montre comment passer un String argument à son constructeur.

<Window
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:src="clr-namespace:SDKSample"
  xmlns:system="clr-namespace:System;assembly=mscorlib"
  SizeToContent="WidthAndHeight"
  Title="Simple Data Binding Sample">

  <Window.Resources>
    <ObjectDataProvider x:Key="myDataSource" ObjectType="{x:Type src:Person}">
      <ObjectDataProvider.ConstructorParameters>
        <system:String>Joe</system:String>
      </ObjectDataProvider.ConstructorParameters>
    </ObjectDataProvider>
    <Style TargetType="{x:Type Label}">
      <Setter Property="DockPanel.Dock" Value="Top"/>
      <Setter Property="FontSize" Value="12"/>
    </Style>
    <Style TargetType="{x:Type TextBox}">
      <Setter Property="Width" Value="100"/>
      <Setter Property="Height" Value="25"/>
      <Setter Property="DockPanel.Dock" Value="Top"/>
    </Style>
    <Style TargetType="{x:Type TextBlock}">
      <Setter Property="Width" Value="100"/>
      <Setter Property="Height" Value="25"/>
      <Setter Property="DockPanel.Dock" Value="Top"/>
    </Style>
  </Window.Resources>

  <Border Margin="25" BorderBrush="Aqua" BorderThickness="3" Padding="8">
    <DockPanel Width="200" Height="100">
      <Label>Enter a Name:</Label>
      <TextBox>
        <TextBox.Text>
          <Binding Source="{StaticResource myDataSource}" Path="Name"
                   UpdateSourceTrigger="PropertyChanged"/>
        </TextBox.Text>
      </TextBox>

      <Label>The name you entered:</Label>
      <TextBlock Text="{Binding Source={StaticResource myDataSource}, Path=Name}"/>
    </DockPanel>
  </Border>
</Window>

Remarques

La modification implicite de cette collection entraîne l’actualisation ObjectDataProvider . Lorsque vous modifiez plusieurs propriétés à l’origine de l’actualisation, l’utilisation est DeferRefresh recommandée.

Utilisation des éléments de propriété XAML

<object>  
  <object.ConstructorParameters>  
    parameterValues  
  </object.ConstructorParameters>  
</object>  

S’applique à