2014-02-10 65 views
3

我正在使用silverlight xaml文件的以下代碼。「Thickness」的TypeConverter不支持從字符串轉換

<UserControl x:Class="DBServer.Selenium.Silvernium.ReferenceApplication.SilverlightFixture"  
      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:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" 
      mc:Ignorable="d" 
      d:DesignWidth="640" 
      d:DesignHeight="480"> 
    <navigation:Frame x:Name="frameContent" Source="/MainPage.xaml" Margin="0,0,0,0"/> // "Margin" on this line throws error 
</UserControl> 

但是,當我嘗試建立它拋出以下錯誤

The TypeConverter for "Thickness" does not support converting from a string 

回答

0

想你的代碼,並沒有拋出任何錯誤,你確定它在XAML,而不是xaml.cs文件運行的代碼是給出該錯誤,因爲厚度是如何定義在這樣的運行代碼的邊距

mainborder.Margin = new Thickness(20, 20, 20, 20); 
相關問題