Reputation: 83
I want to have image as background in my richtextbox command. I'm using, but I can only set background value to already defined colors, not images. (I were using scrollbarviewer but it doesnt show in my richtextbox)
<RichTextBox x:Name="richTextBox" HorizontalAlignment="Left" Height="285" VerticalAlignment="Top" Width="880" VerticalScrollBarVisibility="Visible" IsReadOnly="True" Foreground="#FFA02626" Background="{x:Null}">
<RichTextBox.Resources>
<Style TargetType="ScrollBar">
<Setter Property="Background" Value="Red"/>
</Style>
</RichTextBox.Resources>
</RichTextBox>
Upvotes: 0
Views: 90
Reputation: 149
The Value can be any object, so it can be an ImageBrush. You can do it with the element syntax.
<RichTextBox x:Name="richTextBox" HorizontalAlignment="Left" Height="285" VerticalAlignment="Top" Width="880" VerticalScrollBarVisibility="Visible" IsReadOnly="True" Foreground="#FFA02626" Background="{x:Null}">
<RichTextBox.Resources>
<Style TargetType="ScrollBar">
<Setter Property="Background">
<Setter.Value>
<ImageBrush ImageSource="cool-northern-lights-pic-4.jpg"/>
</Setter.Value>
</Setter>
</Style>
</RichTextBox.Resources>
</RichTextBox>
Upvotes: 1
Reputation: 19997
Try like this-
<RichTextBox>
<RichTextBox.Background>
<ImageBrush ImageSource="some.jpg"/>
</RichTextBox.Background>
</RichTextBox>
See if this helps.
Upvotes: 0