Click here to Skip to main content
15,394,479 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.


XML
<ProgressBar Margin"10" Name="PBar"
       HorizontalAlignment="Left"
       VerticalAlignment="Top"
       Width="150" Height="20" IsIndeterminate="True">
</ProgressBar>
Posted
Updated 6-May-22 15:54pm
v2

1 solution

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?
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900