簡體   English   中英

用戶控件中的自定義工具提示

[英]Custom ToolTip in User Control

我正在使用在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>

但要在UserControl中使用其他樣式。

問題是,如果我在UserControl中定義樣式,則它不會覆蓋App.xaml中的樣式(例如,它適用於ScrollBar),如果樣式不在App.xaml中,則它也不起作用。第一名。

您是否嘗試在UserControl中創建命名樣式(帶有鍵)並使用了此鍵?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM