嗨我目前正在建立一個閃存卡生產力的應用程序,有一個用戶控制,我做了。在進行控制時,我意識到它太小了,無法在我的手機顯示屏上很好地顯示或很好地顯示。於是我開始通過增加控件的寬度和高度來放大用戶控件,並增加了用戶控件中包含的所有控件的文本大小。只有當我嘗試運行控件時,我纔會得到此異常: SuperCards.exe中出現「Windows.UI.Xaml.Markup.XamlParseException」類型的異常,但未在用戶代碼中處理擴大控制
WinRT信息:無法從文本'%0'創建'%1' 」。 [Line:12 Position: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>
這裏視覺工作室通知該異常沒有在用戶控件的構造函數中初始化組件處理。
什麼是你''的xmlns做? – 2014-12-04 16:04:07
我不知道是不是剛添加默認? – opeyemi 2014-12-04 16:10:27
對不起,我只是習慣看到更像=「clr-namespace:viewmodel」,但我特別尋找的是,如果有東西需要類型轉換器或什麼的,因爲它目前顯示,不知道到底是什麼你已經成爲你犯這個錯誤的罪魁禍首了。可能必須顯示一些代碼。 – 2014-12-04 16:15:12