2
Follows code XAML:
<TextBox />
<TextBox.Background>
<ImageBrush x:Name="image_background" Stretch="Fill" TileMode="None" AlignmentX="Left" AlignmentY="Center" />
</TextBox.Background>
</TextBox>
Follows code C#: (The following code has an event click
, to change the black textbox image)
image_background.ImageSource = CreateBitmapSource(System.Windows.Media.Color.FromArgb(255, 0, 0, 0)); // Black Color
What works is only in the event Loaded
:
private void Window_Loaded(object sender, RoutedEventArgs e)
{
// aqui consigo mudar a cor
image_background.ImageSource = CreateBitmapSource(System.Windows.Media.Color.FromArgb(255, 0, 255, 0));
}
Some solution to change the color ?