简体   繁体   English

用户控件中的自定义工具提示

[英]Custom ToolTip in User Control

I'm using a custom tool tip style defined in my App.xaml (without ax:key) 我正在使用在App.xaml中定义的自定义工具提示样式(无ax:key)

       <Style TargetType="ToolTip">
            <Setter Property="Foreground" Value="White" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ToolTip">
                        <Grid Background="#001f5b">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="OpenStates">
                                    <VisualState x:Name="Opened"/>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <ContentPresenter Margin="5"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

but want to use another style in a UserControl. 但要在UserControl中使用其他样式。

The problem is that if I define a style in the UserControl, it doesn't override the style from App.xaml (which works for a ScrollBar for example), nor does it work if a style isn't present in App.xaml in the first place. 问题是,如果我在UserControl中定义样式,则它不会覆盖App.xaml中的样式(例如,它适用于ScrollBar),如果样式不在App.xaml中,则它也不起作用。第一名。

您是否尝试在UserControl中创建命名样式(带有键)并使用了此键?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM