我想問你,如果有人知道如何創建沒有背景的ScrollViewer。我知道這是不可能的風格或模板(我猜),必須從ScrollVeiwer創建新組件,但我找不到哪個方法/屬性覆蓋。沒有背景的滾動查看器
例如:
<Window x:Class="WpfScroll.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow">
<Grid>
<Button x:Name="bt"></Button>
<ScrollViewer Background="{x:Null}" Margin="20">
<StackPanel Orientation="Horizontal" Background="{x:Null}">
<Rectangle Fill="Red" Width="100" Margin="50"></Rectangle>
<Rectangle Fill="Red" Width="100" Margin="50"></Rectangle>
<Rectangle Fill="Red" Width="100" Margin="50"></Rectangle>
<Rectangle Fill="Red" Width="100" Margin="50"></Rectangle>
</StackPanel>
</ScrollViewer>
</Grid>
</Window>
我想是按鈕單擊矩形背景之間的「BT」的能力。
感謝您的諮詢。 -pav-
好吧,我想你知道你可以設置IsHitTestV isible =「False」給scrollviewer。問題是,scrollviewer會吞噬您的鼠標事件。 – SnowballTwo
是的,我知道,但正如你所說,鼠標事件將消失,我需要它們。 – pav