2015-12-04 17 views
11

私は、UWPのXAMLでStaticResource変数のシステム名前空間にアクセスしようとしています。 は、ここに私が使用しているものを(ほとんど)です:UWP/RT XAMLでシステムデータ型を宣言するにはどうすればよいですか?

、私は、次のランタイムエラーになっていたとしてもインテリセンスで <System:Double ...>示すように、有効なものの
<Page 
    x:Class="App.UWP.Views.Step6" 
    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:System="using:System" 
    mc:Ignorable="d"> 

    <Page.Resources> 
     <System:Double x:Key="ItemNameWidth">260</System:Double> 
    </Page.Resources> 

    <TextBlock FontSize="16" Width="{StaticResource ItemNameWidth}">foo</TextBlock> 
</page> 

:私は他に開いている

An exception of type 'Windows.UI.Xaml.Markup.XamlParseException' occurred in mscorlib.ni.dll but was not handled in user code

WinRT information: Cannot deserialize XBF metadata type list as 'Double' was not found in namespace 'System'. [Line: 0 Position: 0]

をこのメソッドが動作しない場合は、doubleを宣言する方法。

答えて

22

デフォルトのx:名前空間になっています。

<Page 
    x:Class="App.UWP.Views.Step6" 
    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:System="using:System" 
    mc:Ignorable="d"> 

    <Page.Resources> 
     <x:Double x:Key="ItemNameWidth">260</x:Double> 
    </Page.Resources> 

    <TextBlock FontSize="16" Width="{StaticResource ItemNameWidth}">foo</TextBlock> 
</page> 
関連する問題