我正在开发一个最初由其他人创建的项目,他们有一个xaml资源字典,其中包含整个解决方案中使用的所有按钮样式。
我正在重新设计解决方案中的一个窗口,它真的会帮助我知道哪些按钮看起来像什么,所以我知道哪些按钮可以在其他地方工作,所以我可以清除一个符合新按钮的样式我是试图制作。
我的问题是有超过30种不同的按钮样式可供查看。
是否有人知道预览将target应用于targetType的结果的好方法?它并不需要简单,只是希望尽可能简单。
注意我尝试过Expression,我没有在那里看到一个选项,但我还没有真正尝试过它。
我现在能想到的最好的事情就是创建一个只包含一个按钮的空白窗口,然后我按照我想要查看的样式输入,然后我会直到找到我想要的内容。有人有更好的系统吗?
我在下面包含了一个样式示例,以防它有用,但看起来它本身有许多依赖项。我只在Silverlight的第2个月,所以通过以下30+以上是有点令人生畏的。
<Style TargetType="Button" x:Key="RightButtonBarButtonStyle">
<Setter Property="Padding" Value="15,0,15,0" />
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontFamily" Value="Segoie"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="Padding" Value="3"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush">
<Setter.Value>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFA3AEB9" Offset="0"/>
<GradientStop Color="#FF8399A9" Offset="0.375"/>
<GradientStop Color="#FF718597" Offset="0.375"/>
<GradientStop Color="#FF617584" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid x:Name="grid" RenderTransformOrigin="0.5,0.5" Height="25">
<Grid.RenderTransform>
<CompositeTransform/>
</Grid.RenderTransform>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0:0:0.2">
<VisualTransition.GeneratedEasingFunction>
<CubicEase EasingMode="EaseOut"/>
</VisualTransition.GeneratedEasingFunction>
</VisualTransition>
</VisualStateGroup.Transitions>
<VisualState x:Name="Normal"/>
<VisualState x:Name="MouseOver">
<Storyboard>
<DoubleAnimation Duration="0" To="0.7" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="grid" d:IsOptimized="True"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<DoubleAnimation Duration="0" To="0.98" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)" Storyboard.TargetName="grid" d:IsOptimized="True"/>
<DoubleAnimation Duration="0" To="0.98" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)" Storyboard.TargetName="grid" d:IsOptimized="True"/>
<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="DisabledVisualElement" d:IsOptimized="True"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="DisabledVisualElement"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused"/>
<VisualState x:Name="Unfocused"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border x:Name="border" BorderBrush="{StaticResource CoreButtonBorderBrush}" BorderThickness="0,1,1,1" CornerRadius="0,15,15,0" Background="{StaticResource CoreButtonBackgroundBrush}"/>
<ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="10,0,10,0" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
<Border BorderBrush="Black" BorderThickness="0" Height="1" Margin="11,1,11,0" VerticalAlignment="Top" Background="{StaticResource CoreButtonTopLineBrush}"/>
<Border BorderBrush="Black" BorderThickness="0" Height="1" Margin="12,0,13,-1" Background="{StaticResource CoreButtonBottomLineBrush}" VerticalAlignment="Bottom" Opacity="0.5"/>
<Border x:Name="DisabledVisualElement" Background="Black" IsHitTestVisible="false" Opacity="0" CornerRadius="0,15,15,0" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
修改 看来我太快就不能解散表达。默认情况下(我假设默认为默认值)程序右侧有一个资源选项卡(属性和数据旁边)。如果它未打开,您可以转到菜单并选择Window-&gt; Resources。
从中显示按xaml文件分组的所有资源,以预览按下相应名称右侧按钮后的样式。只有一个按钮类型没有正确显示(声称有一个重复的键名称,不明白为什么这会阻止预览但它确实如此,所以我猜其他并发症将导致类似的结果)。
我目前正在环顾VS2010,看看我是否能找到类似的功能,但我目前怀疑是否存在,因为这似乎更像是一种表达方式。
因此,如果有人知道Visual Studio 2010中存在的功能,请告诉我,因为这样我就不必在开始编辑后跳转项目和刷新项目。如果可以的话,我也想避免购买Expression。
答案 0 :(得分:0)
看来我太快就不能解雇表达。默认情况下(我假设默认为默认值)程序右侧有一个资源选项卡(属性和数据旁边)。如果它未打开,您可以转到菜单并选择Window-&gt; Resources。
从中显示按xaml文件分组的所有资源,以预览按下相应名称右侧按钮后的样式。只有一个按钮类型没有正确显示(声称有一个重复的键名称,不明白为什么这会阻止预览但它确实如此,所以我猜其他并发症将导致类似的结果)。
我目前正在环顾VS2010,看看我是否能找到类似的功能,但我目前怀疑是否存在,因为这似乎更像是一种表达方式。
因此,如果有人知道Visual Studio 2010中存在的功能,请告诉我,因为这样我就不必在开始编辑后跳转项目和刷新项目。如果可以的话,我也想避免购买Expression。