无法将属性"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.
本文介绍了无法将属性"VerticalAlignment"中的字符串"Top"转换为类型"System.Windows.VerticalAlignment"的对象. Top不是VerticalAlignment的有效值.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我随机出现以下错误.
无法将属性"VerticalAlignment"中的字符串"Top"转换为类型"System.Windows.VerticalAlignment"的对象. Top不是VerticalAlignment的有效值.
请提出可能导致此错误的原因以及为何如此随机.以下是我正在使用的XAML代码.
< ProgressBar 保证金"10" 名称 ="
span> 水平对齐 ="
span> VerticalAlignment ="
span> 宽度 =" 高度 =" IsIndeterminate = " >
< /ProgressBar > 我的猜测是您有一些C#代码正试图将VerticalAlignment属性设置为字符串,而不是正确的类型.我没有在XAML中看到任何会导致错误间歇性发生的内容.什么时候发生错误?在运行时还是编译时?窗口/页面何时加载?当您启动某个事件(例如,单击按钮)时?当您将鼠标悬停在某个元素上时?
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屋!
查看全文