<includeProperty>要素 |
 |
<includeProperty>要素は、あるスタイルの1つのプロパティを別のスタイルに含めます。
構文 |
 |
<includeProperty></includeProperty>
注意:
この要素は派生元要素のすべての属性と子要素を持つことができます。
説明 |
 |
<includeProperty>要素は、あるスタイルの1つのプロパティを別のスタイルに含める場合に使用します。 この点で、<includeProperty>要素は<includeStyle>要素と類似しています。 1つ異なるのは、<includeStyle>では、参照先のスタイルのすべてのプロパティを含めるのに対して、<includeProperty>では、1つのプロパティのみを含める点です。
例 |
 |
<includeProperty>要素は通常、あるスタイルの色の値を、別のスタイルにおいて異なる名前で再利用する際に使用されます。 次の例では、DarkBackgroundスタイルの背景色をDarkForegroundスタイルの前景色として再利用します。
<!-- Define the DarkBackground color -->
<style selector=".DarkBackground">
<property name="background-color">#336699</property>
</style>
<!-- Now define the DarkForeground color, which picks up
its color value from the DarkBackground style -->
<style selector=".DarkForeground">
<includeProperty name=".DarkBackground"
propertyName="background-color"
localPropertyName="color"/>
</style>
これらのスタイルに対応して生成されるCSSは、次のようになります。
.DarkBackground { background-color:#336699 }
.DarkForeground { color:#336699 }
この場合、<includeProperty>要素を使用することによって、色の値(#336699)の変更が、.DarkForegroundスタイルおよび.DarkBackgroundスタイルの両方に反映されるという利点が得られます。
属性 |
 |
|
説明 |
型 |
localPropertyName |
挿入先のスタイル内で使用するプロパティの名前。 localPropertyName 属性では、リモート値を維持したままプロパティの名前をローカルで変更できます。 たとえば、あるスタイルのbackground-colorというプロパティを含め、localPropertyName 属性をcolorに設定することによって、別のスタイルの背景色を前景色として使用できます。 |
string |
|