1
我试图在悬停时创建带有发光效果的功能区菜单。在WPF Ribbon Button中可以吗?像这样http://tympanus.net/Development/IconHoverEffects/#set-8WPF功能区按钮鼠标移动时发光效果
如果是的话是否有人知道如何?谢谢。
这是我到目前为止。
<pbwpf:Window.Resources>
<Style TargetType="{x:Type my:Ribbon}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type my:Ribbon}">
<StackPanel Orientation="Vertical" Height="750" Background="#171f22">
<my:RibbonButton Name="rb_edit" Label="Edit" Margin="0,20,0,0">
<Button.Template>
<ControlTemplate>
<Border VerticalAlignment="Center" HorizontalAlignment="Center">
<Image Source="Images/rb_add4.png" Width="43" Height="43" />
</Border>
</ControlTemplate>
</Button.Template>
</my:RibbonButton>
<my:RibbonButton Name="rb_save" Label="Save" Margin="0,20,0,0">
<Button.Template>
<ControlTemplate>
<Border VerticalAlignment="Center" HorizontalAlignment="Center">
<Image Source="Images/rb_add4.png" Width="43" Height="43" />
</Border>
</ControlTemplate>
</Button.Template>
</my:RibbonButton>
<my:RibbonButton Name="rb_abort" Label="Abort" Margin="0,20,0,0">
<Button.Template>
<ControlTemplate>
<Border VerticalAlignment="Center" HorizontalAlignment="Center">
<Image Source="Images/rb_add4.png" Width="43" Height="43"></Image>
</Border>
</ControlTemplate>
</Button.Template>
</my:RibbonButton>
<my:RibbonButton Name="rb_delete" Label="Delete" Margin="0,20,0,0">
<Button.Template>
<ControlTemplate>
<Border VerticalAlignment="Center" HorizontalAlignment="Center">
<Image Source="Images/rb_add4.png" Width="43" Height="43"></Image>
</Border>
</ControlTemplate>
</Button.Template>
</my:RibbonButton>
<my:RibbonButton Name="rb_search" Label="Search" Margin="0,20,0,0">
<Button.Template>
<ControlTemplate>
<Border VerticalAlignment="Center" HorizontalAlignment="Center">
<Image Source="Images/rb_add4.png" Width="43" Height="43"></Image>
</Border>
</ControlTemplate>
</Button.Template>
</my:RibbonButton>
<my:RibbonButton Name="rb_print" Label="Print" Margin="0,20,0,0">
<Button.Template>
<ControlTemplate>
<Border VerticalAlignment="Center" HorizontalAlignment="Center">
<Image Source="Images/rb_add4.png" Width="43" Height="43"></Image>
</Border>
</ControlTemplate>
</Button.Template>
</my:RibbonButton>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Label">
<Setter Property="FontFamily" Value="Lubalin" />
<Setter Property="Foreground" Value="#338e8f" />
<Setter Property="FontSize" Value="18" />
<!--<Setter Property="Opacity" Value="0.2" />-->
</Style>
</pbwpf:Window.Resources>
<Grid>
<Border BorderBrush="#9ac3cb" BorderThickness="1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="55" />
<RowDefinition Height="745" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="55" />
<ColumnDefinition Width="969" />
</Grid.ColumnDefinitions>
<Border Name="bms" Grid.Row="0" Grid.Column="0" Background="#3fb5af">
<Label Name="lbl_bms" Content="BMS " VerticalAlignment="Center" HorizontalAlignment="Center" />
</Border>
<Border Name="header" Grid.Row="0" Grid.Column="1" Background="#ecf0f1" BorderBrush="Gray" BorderThickness="0,0,0,1"></Border>
<Border Name="btn_clse" Grid.Row="0" Grid.Column="1" Background="#ecf0f1" HorizontalAlignment="Right" BorderBrush="Gray" BorderThickness="0,0,0,1">
<Image Source="Images/c_lose.png" Height="40" Width="40"></Image>
</Border>
<pbwpf:StaticText Grid.Row="0" Grid.Column="1" Height="21" HorizontalAlignment="Left" Margin="10,20,0,0" Name="st_dte" Text="Main Form" TextSize="-10" VerticalAlignment="Top" Width="88" PBHeight="84" PBWidth="402" X="46" Y="80" />
<Border Name="sidebar" Grid.Row="1" Grid.Column="0" Background="#171e24">
<StackPanel VerticalAlignment="Top" Orientation="Vertical" HorizontalAlignment="Left">
<my:Ribbon Height="745" Name="ribbon1" TabIndex="10" Width="55">
<my:Ribbon.ApplicationMenu>
<my:RibbonApplicationMenu Visibility="Collapsed" />
</my:Ribbon.ApplicationMenu>
</my:Ribbon>
</StackPanel>
</Border>
<Border Grid.Row="1" Grid.Column="1">
<!--<pbwpf:MDIClient Name="mdi1" Background="white"></pbwpf:MDIClient>-->
</Border>
</Grid>
</Border>
</Grid>
下面是我想要实现的样式的屏幕截图。
嗨@pushpraj谢谢你!这是我正在寻找的。你太好了!!非常感谢你。我会将此标记为答案!再次感谢。 – 2014-09-03 07:44:32
嗨!另一个问题。 WPF Ribbon中可能会产生效果吗?谢谢! – 2014-09-03 07:57:02
是的,这确实是可能的。你可以给我一个链接到你正在使用的图书馆,我可以试一试。同时,您可以将样式的目标类型更改为功能区按钮,并查看是否符合要求,您可以根据需要调整模板。 – pushpraj 2014-09-03 11:51:31