首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >X:静态在TextBlock中不起作用。(WPF)

X:静态在TextBlock中不起作用。(WPF)
EN

Stack Overflow用户
提问于 2022-06-16 12:00:56
回答 1查看 43关注 0票数 0

我刚开始学习WPF,出现了一个问题。X:静态不显示来自.resx文件的值,只写行本身。控制台中没有错误。

代码语言:javascript
复制
        <TextBlock VerticalAlignment="Center" Padding="15, 0, 0, 0" FontSize="39.75" FontFamily="{StaticResource LeagueGothic}" Foreground="White">
            {x:Static language:Lang.found_bug}
        </TextBlock>

同时,它只是没有在TextBlock中显示。

全文件列表

代码语言:javascript
复制
<Window x:Class="YandereSimulatorLauncher2.Popups.ReportLauncherBug"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:YandereSimulatorLauncher2.Popups"
    xmlns:controls="clr-namespace:YandereSimulatorLauncher2.Controls"
    mc:Ignorable="d"
    xmlns:language="clr-namespace:YandereSimulatorLauncher2.Properties.Lang"

    Title="{x:Static language:Lang.bug_report}" Height="440" Width="900" Background="#ff80d3" ResizeMode="NoResize">
<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="55"/>
        <RowDefinition Height="*"/>
        <RowDefinition Height="5"/>
    </Grid.RowDefinitions>
    <Grid Background="#ee63bb" Grid.Row="0">
        <TextBlock VerticalAlignment="Center" Padding="15, 0, 0, 0" FontSize="39.75" FontFamily="{StaticResource LeagueGothic}" Foreground="White">
            {x:Static language:Lang.found_bug}
        </TextBlock>
    </Grid>
    <Grid Grid.Row="1">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="5"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="5"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="5"/>
        </Grid.ColumnDefinitions>
        <Grid Grid.Column="0" Background="#ee63bb" />
        <Grid Grid.Column="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="45"/>
                <RowDefinition Height="5"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Grid>
                <TextBlock FontSize="28" FontFamily="{StaticResource LeagueGothic}" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center">
                    Bug in the launcher
                </TextBlock>
            </Grid>
            <Grid Grid.Row="1" Background="#ee63bb"/>
            <Grid Grid.Row="2" VerticalAlignment="Top">
                <Grid.RowDefinitions>
                    <RowDefinition Height="10"></RowDefinition>
                    <RowDefinition Height="35"></RowDefinition>
                    <RowDefinition Height="71"></RowDefinition>
                    <RowDefinition Height="35"></RowDefinition>
                    <RowDefinition Height="92"></RowDefinition>
                    <RowDefinition Height="35"></RowDefinition>
                </Grid.RowDefinitions>
                <TextBlock Grid.Row="1" TextWrapping="Wrap" Foreground="White" HorizontalAlignment="Center" FontSize="17.25" VerticalAlignment="Center" Background="#ee63bb" Padding="5">
                    <Italic><Bold>Do not</Bold> submit launcher bug reports to YandereDev.</Italic>
                </TextBlock>
                <TextBlock Grid.Row="2" TextWrapping="Wrap" TextAlignment="Justify" FontSize="15.25" Foreground="White" Padding="6, 3, 6, 3">
                    The Yandere Simulator launcher is an open-source project that is maintained by volunteers.
                    The project lead accepts bug reports by email at the following address:
                </TextBlock>
                <Grid Grid.Row="3">
                    <controls:OtherHyperlinkFromText LinkFontSize="25.75" IsDere="False" DisplayText="scott@loosescrew.ca" LinkedUrl="mailto:scott@loosescrew.ca" />
                </Grid>
                <TextBlock Grid.Row="4" TextWrapping="Wrap" TextAlignment="Justify" FontSize="15.25" Foreground="White" Padding="6, 3, 6, 3">
                    Check out the status of reported bugs by looking at the project's issues tab on GitHub. If you have an account, you may also comment on issues, submit pull requests, and otherwise contribute to the launcher.
                </TextBlock>
                <Grid Grid.Row="5">
                    <controls:OtherHyperlinkFromText  LinkFontSize="25.75" IsDere="False" DisplayText="YandereSimulatorLauncher2 on GitHub" LinkedUrl="https://github.com/scottmichaud/yanderesimulatorlauncher2"/>
                </Grid>
            </Grid>
        </Grid>
        <Grid Grid.Column="2" Background="#ee63bb" />
        <Grid Grid.Column="3">
            <Grid.RowDefinitions>
                <RowDefinition Height="45"></RowDefinition>
                <RowDefinition Height="5"></RowDefinition>
                <RowDefinition Height="*"></RowDefinition>
            </Grid.RowDefinitions>
            <Grid Grid.Row="0">
                <TextBlock FontSize="28" FontFamily="{StaticResource LeagueGothic}" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center">
                    Bug in the game
                </TextBlock>
            </Grid>
            <Grid Grid.Row="1" Background="#ee63bb"/>
            <Grid Grid.Row="2" VerticalAlignment="Top">
                <Grid.RowDefinitions>
                    <RowDefinition Height="4"></RowDefinition>
                    <RowDefinition Height="50"></RowDefinition>
                    <RowDefinition Height="35"></RowDefinition>
                    <RowDefinition Height="65"></RowDefinition>
                </Grid.RowDefinitions>
                <TextBlock Grid.Row="1" TextWrapping="Wrap" FontSize="15.75" TextAlignment="Justify" Foreground="White" Padding="6, 3, 6, 3">
                    If the bug affects the game, not the launcher, then submit the game bug to YandereDev through his website.
                </TextBlock>
                <Grid Grid.Row="2">
                    <controls:OtherHyperlinkFromText LinkFontSize="25.75" IsDere="False" DisplayText="yanderesimulator.com/bug-reporting" LinkedUrl="https://yanderesimulator.com/bug-reporting/" />
                </Grid>
                <TextBlock Grid.Row="3" TextWrapping="Wrap" TextAlignment="Center" Foreground="White" HorizontalAlignment="Center" FontSize="15.75" VerticalAlignment="Center" Background="#ee63bb" Padding="5" Margin="5, 0, 5, 0">
                    <Italic><Bold>Do not</Bold> submit launcher bugs to the above link. <LineBreak/> &lt;-- Report bugs affecting the launcher on the left.</Italic>
                </TextBlock>
            </Grid>
        </Grid>
        <Grid Grid.Column="4" Background="#ee63bb" />
    </Grid>
    <Grid Grid.Row="2" Background="#ee63bb"/>
</Grid>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-06-16 12:26:17

{...}是标记扩展语法,仅在属性中有效。两者都是

代码语言:javascript
复制
<TextBlock Text="{x:Static language:Lang.found_bug}" VerticalAlignment="Center" Padding="15, 0, 0, 0" FontSize="39.75" FontFamily="{StaticResource LeagueGothic}" Foreground="White"/>

代码语言:javascript
复制
<TextBlock VerticalAlignment="Center" Padding="15, 0, 0, 0" FontSize="39.75" FontFamily="{StaticResource LeagueGothic}" Foreground="White">
    <x:Static Member="language:Lang.found_bug"/>
</TextBlock>
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72645496

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档