Skip to content

How Can I styled ToolTip and share the TextBlock? #19228

Answered by Flithor
Flithor asked this question in Q&A
Discussion options

You must be logged in to vote

I have done it, for who comes latter:

<ParentControl.Styles>
    <Style Selector="TextBox.WithCustomToolTip">
        <!-- Some setter-->
        <!-- Explicitly set ToolTip.Tip, event the empty string-->
        <Setter Property="ToolTip.Tip" Value="" />

        <!-- Nested styles for ToolTip-->
        <Style Selector="^ ToolTip">
            <Setter Property="Background" Value="#2D2D2D" />
            <Setter Property="MaxWidth" Value="NaN" />

            <!-- change to from parent -->
            <Setter Property="Width" Value="{Binding $parent[TextBox].Bounds.Width}" />

            <!-- use ContentTemplate to share TextBlock Control -->
            <Setter Property="ContentTemplat…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Bobsoftru
Comment options

@Flithor
Comment options

Answer selected by Flithor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants