2

XAMLとC#を使用してWindows8アプリを開発しています。ローカリゼーション文字列を格納するためのリソース辞書を作成しました。

「<String>」タグをそのまま使用している間、コンパイラはそれを認識しますが、サポートされていないと言います。

私の現在の構成では:

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:s="using:System">

    <s:String x:Key="start">Start</s:String>
    <s:String x:Key="pause">Pause</s:String>
    <s:String x:Key="stop">Stop</s:String>

    <s:String x:Key="deleteSelected">Delete Selected</s:String>

    <s:String x:Key="timer">Timer</s:String>
    <s:String x:Key="timers">Timers</s:String>
    <s:String x:Key="stopper">Stopper</s:String>
    <s:String x:Key="stoppers">Stoppers</s:String>
    <s:String x:Key="alarmClock">Alarm Clock</s:String>
    <s:String x:Key="alarmClocks">Alarm Clocks</s:String>

    <s:String x:Key="recordLap">Record Lap</s:String>
</ResourceDictionary>

これはデバッグ出力です:

'TimeLord.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TimeLord.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\Gilad Naaman\documents\visual studio 2012\Projects\TimeLord\TimeLord\bin\Debug\AppX\TimeLord.exe', Symbols loaded.
'TimeLord.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TimeLord.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\system32\WinMetadata\Windows.UI.Xaml.winmd', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TimeLord.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.InteropServices.WindowsRuntime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.InteropServices.WindowsRuntime.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TimeLord.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\system32\WinMetadata\Windows.ApplicationModel.winmd', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TimeLord.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Collections\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Collections.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TimeLord.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ObjectModel\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.ObjectModel.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TimeLord.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TimeLord.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\system32\WinMetadata\Windows.Foundation.winmd', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TimeLord.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.WindowsRuntime.UI.Xaml\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.WindowsRuntime.UI.Xaml.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TimeLord.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.WindowsRuntime\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.WindowsRuntime.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
A first chance exception of type 'Windows.UI.Xaml.Markup.XamlParseException' occurred in TimeLord.exe
WinRT information: The type 'String' was not found. [Line: 13 Position: 44]
An exception of type 'Windows.UI.Xaml.Markup.XamlParseException' occurred in TimeLord.exe but was not handled in user code
WinRT information: The type 'String' was not found. [Line: 13 Position: 44]
Additional information: Unspecified error
'TimeLord.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.DLL'
'TimeLord.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TimeLord.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
A first chance exception of type 'System.Exception' occurred in TimeLord.exe
'TimeLord.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Diagnostics.Debug\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Diagnostics.Debug.dll'
The program '[4992] TimeLord.exe: Program Trace' has exited with code 0 (0x0).
The program '[4992] TimeLord.exe: Managed (v4.0.30319)' has exited with code -1073741189 (0xc000027b).
Activation of the Windows Store app 'f109d0b0-d566-47cd-9551-2969e7b4abab_capbppsrwz44p!App' failed with error 'Windows was unable to communicate with the target application.  This usually indicates that the target application's process aborted. More information may be available in the Debug pane of the Output window (Debug->Windows->Output)'.
4

1 に答える 1

4

代わりにこれを使用してください:

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

     <x:String x:Key="start">Start</x:String>

MSDN でこの例を参照してください

于 2012-08-28T13:34:05.853 に答える