2012-09-24 17 views
0

我想把一個richtextbox放在一個圖像上,如果這個圖像不透明度降低到0.8的話。 現在,我想要一個richtextbox在圖像上顯示一些不斷下載的信息。我準備好了richtextbox,但設計視圖不允許將richtextbox放在圖像上,圖像向下滑動。我已經瀏覽了richtextbox的所有屬性,逐個更改了它們,但都沒有成功。我怎樣才能做到這一點? 換句話說,也許我想知道如何將控件放在另一個上?無法在msdn上找到太多...如何將richtextbox放在xaml中的圖像上?

+0

找到相似的主題無論如何。 http://stackoverflow.com/questions/5450985/how-to-make-overlay-control-above-all-other-controls – vish213

回答

0

下面是圖像上的TextBox(滾動)示例。它應該與RichTextBox一起使用。

<Grid> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="*"/> 
    </Grid.RowDefinitions> 
    <Grid.Background> 
     <ImageBrush ImageSource="{StaticResource yourImage}" Opacity=".3"> 
      <ImageBrush.RelativeTransform> 
       <ScaleTransform ScaleX=".5" ScaleY=".5" CenterX=".5" CenterY=".5"/> 
      </ImageBrush.RelativeTransform> 
     </ImageBrush> 
    </Grid.Background>     
    <ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto"> 
     <TextBlock x:Name="YourTextBox" Grid.Row="1" Background="Transparent" Margin="3,6,3,0" Text="{Binding YourMessage}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" TextWrapping="Wrap"/> 
    </ScrollViewer> 
</Grid> 
相關問題