文本框的背景色

时间:2018-09-26 18:05:40

标签: xaml silverlight

我在Silverlight Fram的数据模板中有一个文本框

<DataTemplate x:Key="ResponseNotificationTemplate">
            <StackPanel Orientation="Horizontal">
                <StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Style="{StaticResource TextBlockBase}" Text="{Binding Source={StaticResource LocalizedStrings}, Path=StringsRes.UsageReportID}" TextWrapping="Wrap"
                             Margin="8,7,9,0" VerticalAlignment="Stretch" FontWeight="Bold">
                        </TextBlock>
                        <TextBox Text="{Binding UsageReportExtendedResponse.UsageReportUniqueID}" IsReadOnly="True" Margin="0,3,9,0" Background="Gray" VerticalAlignment="Stretch" FontWeight="Bold" FontSize="12.5"/>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <StackPanel Orientation="Vertical">
                            <TextBlock Style="{StaticResource TextBlockBase}" Text="{Binding Source={StaticResource LocalizedStrings}, Path=StringsRes.MSReceivedDateLabel}" TextWrapping="Wrap" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="8,0,12,0"></TextBlock>
                            <TextBlock Style="{StaticResource TextBlockBase}" Text="{Binding Source={StaticResource LocalizedStrings}, Path=StringsRes.AliasLabel}" TextWrapping="Wrap" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="8,0,12,5"></TextBlock>
                        </StackPanel>
                        <StackPanel Orientation="Vertical">
                            <TextBlock Style="{StaticResource TextBlockBase}" Text="{Binding UsageReportExtendedResponse.MSReceivedDateUTC}" TextWrapping="Wrap" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="10,0,12,0"></TextBlock>
                            <TextBlock Style="{StaticResource TextBlockBase}" Text="{Binding Alias}" TextWrapping="Wrap" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="10,0,12,5"></TextBlock>
                        </StackPanel>
                    </StackPanel>
                    <TextBlock Style="{StaticResource TextBlockBase}" Text="Please use search usage reports to view validation results of &#10;uploaded report." Margin="8,0,12,0"></TextBlock>
                </StackPanel>
            </StackPanel>
        </DataTemplate>

但是当通知弹出时,背景颜色不会改变并保持白色。

我能获得关于为什么发生这种情况以及如何更改背景颜色的任何线索的信息。我什至尝试将样式定义为静态资源,然后将该样式应用于文本框,但这甚至行不通。

0 个答案:

没有答案