无法将属性"VerticalAlignment"中的字符串"Top"转换为类型"System.Windows.VerticalAlignment"的对象. Top不是VerticalAlignment的有效值. [英] Cannot convert string 'Top' in attribute 'VerticalAlignment' to object of type 'System.Windows.VerticalAlignment'. Top is not a valid value for VerticalAlignment.

查看:288
本文介绍了无法将属性"VerticalAlignment"中的字符串"Top"转换为类型"System.Windows.VerticalAlignment"的对象. Top不是VerticalAlignment的有效值.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我随机出现以下错误.

无法将属性"VerticalAlignment"中的字符串"Top"转换为类型"System.Windows.VerticalAlignment"的对象. Top不是VerticalAlignment的有效值.

请提出可能导致此错误的原因以及为何如此随机.以下是我正在使用的XAML代码.


 <   ProgressBar    保证金"10"    名称  ="  
 
                   span> 水平对齐  ="  
 
                     span>  VerticalAlignment   ="  
 
                     span> 宽度  ="    高度  ="     IsIndeterminate   = "  > 
<  /ProgressBar  >   


I am getting following error randomly.

cannot convert string ''Top'' in attribute ''VerticalAlignment'' to object of type ''System.Windows.VerticalAlignment''. Top is not a valid value for VerticalAlignment.

Please suggest what could be causing this error to come up and why it is so random. Following is XAML code i am using.


<ProgressBar Margin"10" Name="PBar"

       HorizontalAlignment="Left"

       VerticalAlignment="Top"

       Width="150" Height="20" IsIndeterminate="True">
</ProgressBar>

解决方案

My guess is you have some C# code that is attempting to set the VerticalAlignment property to a string rather than of the correct type. I don''t see anything in the XAML that would cause that to error to happen intermittently. When does the error occur? At runtime or compile time? When the Window/Page loads? When you initiate some event (e.g., clicking a button)? When you mouse over a certain element?


这篇关于无法将属性"VerticalAlignment"中的字符串"Top"转换为类型"System.Windows.VerticalAlignment"的对象. Top不是VerticalAlignment的有效值.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆