我已经从网格应用程序(XAML)模板(C#Windows Store)创建了一个新项目。 到目前为止,我没有改变模板中的任何内容,但我想从网格中的特定行更改背景颜色。C#更改背景颜色特定行
<!--
This grid acts as a root panel for the page that defines two rows:
* Row 0 contains the back button and page title
* Row 1 contains the rest of the page layout
-->
<Grid Style="{StaticResource LayoutRootStyle}">
<Grid.RowDefinitions>
<RowDefinition Height="140"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
我想从第0行(其中包含页面标题)更改backgroundcolor。 任何想法??提前致谢!的
该行consits:
<!-- Back button and page title -->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}"/>
<TextBlock x:Name="pageTitle" Text="{StaticResource AppName}" Grid.Column="1" IsHitTestVisible="false" Style="{StaticResource PageHeaderTextStyle}"/>
</Grid>
不幸的是文本块项目不包含背景属性的边界。我编辑了我的帖子以显示哪些项目在该行中。 – user1951083 2013-03-12 08:33:07
啊,我的道歉,我没有看到你的帖子上的Silverlight标签,WPF TextBlock有背景。 – Dutts 2013-03-12 08:36:25
但我不想改变按钮的背景,它必须是整行。 – user1951083 2013-03-12 08:36:28