xaml codes are here;
Code:
<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<TextBlock x:Name="TextBlock1" Width="100" Height="20" Background="Blue"/>
</Grid>
</Window>
vb.net codes are here;
Code:
Class MainWindow
Private Sub MainWindow_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
Dim myBrush1 As New SolidColorBrush(CType(ColorConverter.ConvertFromString("#FF0000"), Color))
TextBlock1.Background = myBrush1
End Sub
End Class
The codes above are okey.
My question is here;
I want to use
Code:
TextBlock1.Background = "myBrush" & 1
instead of
Code:
TextBlock1.Background = myBrush1
I think I need a code something like this;
Code:
Dim myBrush As SolidColorBrush = CType("myBrush" & 1, SolidColorBrush)
TextBlock1.Background = myBrush