简体   繁体   中英

WPF button text scrolling on mouse over

is it possible for buttons that have longer Content(text) than the max button width to kinda scroll the remaining text from right to left on mouse over? something like an electronic banner is the best I could explain it.

as of now this is the only thing that reflects my button style xaml.

<Page.Resources>
    <Style x:Key="Str" TargetType="{x:Type Button}">
        <Setter Property="Width" Value="90"/>
    </Style>

</Page.Resources>

Yes. That's usually called marquee.

You can template a wpf control to do just about anything.

Put a canvas in there and a textblock. Animate the canvas.Left of the textblock. There's a marquee implementation here:

https://social.technet.microsoft.com/wiki/contents/articles/31416.wpf-mvvm-friendly-user-notification.aspx?Redirected=true#Marquee

You would, obviously, want to start the animation using a datatrigger and ismouseover true.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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