【问题标题】:The TypeConverter for "Thickness" does not support converting from a string“Thickness”的 TypeConverter 不支持从字符串转换
【发布时间】:2014-02-10 23:21:28
【问题描述】:

我正在为 silverlight xaml 文件使用以下代码。

<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

【问题讨论】:

    标签: c# .net xaml silverlight-5.0


    【解决方案1】:

    试过你的代码,它没有抛出任何错误,你确定它在 xaml 中,而不是在运行给出该错误的代码的 xaml.cs 文件中,因为厚度是你在运行代码中定义边距的方式像这样

    mainborder.Margin = new Thickness(20, 20, 20, 20);
    

    【讨论】:

      猜你喜欢
      • 2012-08-13
      • 1970-01-01
      • 1970-01-01
      • 2011-01-20
      • 2016-03-23
      • 2019-07-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多