假设我有这个UserControl并且想要将属性移动到样式而不必手动执行它?
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
x:Class="Testing.MainPage"
Width="640" Height="480">
<Grid x:Name="LayoutRoot" Background="White">
<Button x:Name="mybutton"
Content="Button"
BorderThickness="5"
Background="Red" />
</Grid>
</UserControl>
所以我想创建一个新样式并将BorderThickness和Background移动到新样式?
答案 0 :(得分:3)