gpt4 book ai didi

c# - 扩大控制

转载 作者:太空宇宙 更新时间:2023-11-03 13:13:57 24 4
gpt4 key购买 nike

您好,我目前正在构建一个闪存卡生产力应用程序,它具有我制作的用户控件。在制作控件时,我意识到它太小而无法在我的手机显示屏上很好地显示或呈现。因此,我开始通过增加控件的宽度和高度以及增加用户控件中包含的所有控件的文本大小来扩大用户控件。只有当我尝试运行控件时,才会出现此异常:SuperCards.exe 中出现“Windows.UI.Xaml.Markup.XamlParseException”类型的异常,但未在用户代码中处理

WinRT 信息:无法从文本“%0”创建“%1”。 [行:12 位置:48]

附加信息:找不到与此错误代码关联的文本。

这是用户控件的 xaml 代码:

<UserControl
x:Class="SuperCards.CardPackItemListView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:SuperCards"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="125"
d:DesignWidth="400" >
<Border CornerRadius="2" BorderThickness="1" BorderBrush="White">
<Grid Background="White" Height="Auto" Width=" Auto">
<TextBlock x:Name="cardPackItemNameDisplay" HorizontalAlignment="Left" VerticalAlignment="Top" Width="Auto" Height="Auto" Text="(Sample) Periodic Table" Foreground="Gray" Margin="9,9,0,0" FontSize="30" />
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="9,30,9,9" Width="Auto" Height="9" Background="gray" >
<Rectangle HorizontalAlignment="Left" VerticalAlignment="Stretch" Fill="Red" Width="46"/>
</Grid>
<TextBlock HorizontalAlignment="Right" VerticalAlignment="Top" Text="36" Foreground="Gray" Margin="0,9,9,0" FontSize="30"/>
</Grid>
</Border>

此时,visual studios 通知用户控件的构造函数内的初始化组件未处理异常。

最佳答案

第 12 行的以下属性与错误消息中的行相对应;删除引号内的前导空格:

Width=" Auto"

如果 WinRT 中的颜色名称区分大小写,这也可能会导致问题;最好将 Gray 中的 G 大写以防万一:

Background="gray"

关于c# - 扩大控制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27297468/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com