[WPF] 如何在自己定义的style里动态绑定图片 WFPStyleTabItem 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 代码贴错了,复制多了...不好意思.只有下面这一点. <TabItem.Style> <Style TargetType="{x:Type TabItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type TabItem}"> <ControlTemplate.Resources> <Storyboard x:Key="Storyboard1"> <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" Storyboard.TargetName="sp"> <EasingColorKeyFrame KeyTime="0" Value="White"/> <EasingColorKeyFrame KeyTime="0:0:0.2" Value="#FFFFCE4E"/> </ColorAnimationUsingKeyFrames> </Storyboard> </ControlTemplate.Resources> <StackPanel x:Name="sp" Background="White"> <Image Width="84" Height="70" Source="/Images/TabIcon/3.png" Margin="0,0,0,0" ></Image> <Label Content="警报管理" HorizontalAlignment="Center"/> </StackPanel> <ControlTemplate.Triggers> <Trigger Property="IsSelected" Value="True"> <Trigger.EnterActions> <BeginStoryboard Storyboard="{StaticResource Storyboard1}"/> </Trigger.EnterActions> <Setter TargetName="sp" Property="Background" Value="#FFFFCE4E"></Setter> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> </TabItem.Style> 请问如何把这个style写成通用的啊,图片由具体的时候再定.希望大家给点建议和方法 我说的不够详细吗?我就是想把这一行<Image Width="84" Height="70" Source="/Images/TabIcon/3.png" Margin="0,0,0,0" ></Image>写的更加具有适用性,能够根据具体的按钮改图片 可以做一个用户控件 控件添加属性去绑定图片,TabItem的模版就是这个用户空间 同问这个问题,能否给个demo啊。 谁解决了么 给个demo吧... 请教大家一个关于“ (T) 与 (obj.GetType()) 区别”的问题。 什么控件可以显示成如此效果? C#位图问题 怎么在窗口上弹出一个提示信息? 一个窗口关闭时如何设置另外一个窗口enable=true? 请问这种情况怎么同步? web和c#写的程序怎样即时通信? 请问哪位朋友能帮忙解决解决代码中的错误! richeditbox 字体设置无效的问题 为什么不对? 用C#调用EXE程序,不知道参数名字 从数据类型 varchar 转换为 numeric 时出错 怎么解决
<Style TargetType="{x:Type TabItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabItem}">
<ControlTemplate.Resources>
<Storyboard x:Key="Storyboard1">
<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)"
Storyboard.TargetName="sp">
<EasingColorKeyFrame KeyTime="0" Value="White"/>
<EasingColorKeyFrame KeyTime="0:0:0.2" Value="#FFFFCE4E"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
</ControlTemplate.Resources>
<StackPanel x:Name="sp" Background="White">
<Image Width="84" Height="70" Source="/Images/TabIcon/3.png" Margin="0,0,0,0" ></Image>
<Label Content="警报管理" HorizontalAlignment="Center"/>
</StackPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Trigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
</Trigger.EnterActions>
<Setter TargetName="sp" Property="Background" Value="#FFFFCE4E"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</TabItem.Style>
写的更加具有适用性,能够根据具体的按钮改图片