ComponentResourceKey.ResourceId 屬性

定義

取得或設定唯一識別項,以將這個索引鍵與這個型別的其他相關聯索引鍵相區別。

public:
 property System::Object ^ ResourceId { System::Object ^ get(); void set(System::Object ^ value); };
public object ResourceId { get; set; }
member this.ResourceId : obj with get, set
Public Property ResourceId As Object

屬性值

唯一識別碼。 通常,這會是字串。

範例

下列範例示範如何使用 ResourceId 來區分此索引鍵與與此類型相關聯的其他人。

<Style 
    x:Key="{ComponentResourceKey 
        TypeInTargetAssembly={x:Type local:ColorPicker},
        ResourceId=ColorSliderStyle}"
    TargetType="{x:Type Slider}">

    <Setter Property="Minimum" Value="0"/>
    <Setter Property="Maximum" Value="255"/>
    <Setter Property="SmallChange" Value="1"/>
    <Setter Property="LargeChange" Value="51"/>
    <Setter Property="IsMoveToPointEnabled" Value="true"/>
    <Setter Property="Orientation" Value="Horizontal"/>
</Style>

備註

如需 XAML 資訊,請參閱 ComponentResourceKey 標記延伸

一般而言,用於 ResourceId 值的字串符合 XamlName 文法

適用於