b

blu

Sunday, 23 December 2012

Converting String to Color Object in VB.NET Silverlight


Converting String to Color Object in VB.NET Silverlight


Dim myColor As String =  "Red"
            String xamlString = "<Canvas xmlns=\"http:'schemas.microsoft.com/winfx/2006/xaml/presentation\" Background=\""+myColor +"\"/>";

            Dim c As Canvas = CType(System.Windows.Markup.XamlReader.Load(xamlString), Canvas)
            Dim mistyRoseBrush As SolidColorBrush = CType(c.Background, SolidColorBrush)
            Dim backColor As Color =  mistyRoseBrush.Color

            Dim FinalBrush As SolidColorBrush =  New SolidColorBrush(backColor)

No comments:

Post a Comment