[英]XAML Style tag - property of property
In my ResourceDictionary.xaml
I have a <Style>
for one of my view templates. 在我的
ResourceDictionary.xaml
我有一个<Style>
用于我的一个视图模板。 Inside, I have set a tooltip in the following way: 在里面,我用以下方式设置了一个工具提示:
<Setter Property="ToolTip">
<Setter.Value>
<templates:MyToolTipTemplate/>
</Setter.Value>
</Setter>
How can I access the Tooltip
's properties (I need to set StaysOpen
)? 如何访问
Tooltip
的属性(我需要设置StaysOpen
)?
Probably this can give you a direction for what you actually need. 可能这可以为您提供实际需要的方向。
Assuming that templates:MyToolTipTemplate
is related to View (eg its a Control): 假设
templates:MyToolTipTemplate
与View相关(例如它的一个Control):
<Setter Property="ToolTip">
<Setter.Value>
<ToolTip StaysOpen="{Binding SomeBoolProperty,ElementName=template}">
<templates:MyToolTipTemplate x:Name="template"/>
</ToolTip>
</Setter.Value>
</Setter>
If templates:MyToolTipTemplate
is a ViewModel entity, you can place a relevant binding in a corresponding DataTemplate: 如果
templates:MyToolTipTemplate
是ViewModel实体,则可以在相应的DataTemplate中放置相关绑定:
<DataTemplate DataType="{x:Type templates:MyToolTipTemplate}">
<ToolTip>
<SomeControl SomeProperty="{Binding StaysOpen,
RelativeSource={RelativeSource AncestorType=ToolTip}, Mode=OneWayToSource}"/>
</ToolTip>
</DataTemplate>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.