我尝试使用像这样的自定义按钮样式更改鼠标悬停时按钮内容的椭圆的描边:
<Button x:Name="MyButton" Style="{StaticResource MyButtonStyle}">
<StackPanel>
<Ellipse Width="20" Height="20" Stroke="{x:Bind MyButton.Foreground, Mode=OneWay}"></Ellipse>
<TextBlock Foreground="{x:Bind MyButton.Foreground, Mode=OneWay}" Text="Not Working" />
<TextBlock Text="Working" />
</StackPanel>
</Button>
为什么只有TextBlock与Text&#34; Working&#34;改变它的前景属性?
var tbody = $('#tbody'),
htmlStr = "";
for (var i = 0, len = articlelist.length; i < len; i++) { // avoid accessing 'length' property on each iteration
htmlStr += '<tr><td>' + articlelist[i].id + '</td>'
+ '<td>' + articlelist[i].channelid + '</td>'
+ '<td>' + articlelist[i].comment + '</td>'
+ '<td>' + articlelist[i].last_edit_time + '</td><td><tr>';
}
tbody.append(htmlStr); // parses the specified text as HTML or XML and inserts the resulting nodes
答案 0 :(得分:1)
ContentPresenter
的前景而不是Button
(MyButton
)的前景。ContentControl
代替ContentPresenter
以访问模板中的其他属性。 Foreground
,例如以下内容。代码:
<StackPanel>
<Ellipse Width="20" Height="20" Stroke="{x:Bind MyText.Foreground, Mode=OneWay}"></Ellipse>
<TextBlock Foreground="{x:Bind MyText.Foreground, Mode=OneWay}" Text="Not Working" />
<TextBlock x:Name="MyText" Text="Working" />
</StackPanel>