悬赏园豆:30
[已关闭问题]
关闭于 2008-02-11 19:20
<P>controltemplate至今还不是很理解,我想通过template来定义scrollviewer的外观(比如他那个滚动条不好看),我这样写:</P>
<P><ScrollViewer Height="100" VerticalScrollBarVisibility="Disabled" <BR> CanContentScroll="True" Name="sv_photo" HorizontalScrollBarVisibility="Visible"><BR> <ScrollViewer.Template><BR> <ControlTemplate><BR> <DockPanel Background="blue" LastChildFill="true"><BR> <ScrollBar Orientation="Horizontal" DockPanel.Dock="Bottom" Minimum="0" Maximum="{TemplateBinding ScrollViewer.ScrollableWidth}" Value="{TemplateBinding ScrollViewer.HorizontalOffset}" ViewportSize="{TemplateBinding ScrollViewer.ViewportWidth}" Name="PART_HorizontalScrollBar" Visibility="{TemplateBinding ScrollViewer.ComputedHorizontalScrollBarVisibility}"/><BR> <ContentPresenter Content="{TemplateBinding ScrollViewer.Content}" /></P>
<P> </DockPanel><BR> </ControlTemplate><BR> </ScrollViewer.Template><BR> <StackPanel Name="sp1"><BR> <Button Click="But_right_click">Button 1</Button><BR> <Button>Button 2</Button><BR> <Button>Button 3</Button><BR> <Button>Button 4</Button><BR> &
问题补充:
内容被截断了:
<ScrollViewer Height="100" VerticalScrollBarVisibility="Disabled"
CanContentScroll="True" Name="sv_photo" HorizontalScrollBarVisibility="Visible">
<ScrollViewer.Template>
<ControlTemplate>
<DockPanel Background="blue" LastChildFill="true">
<ScrollBar Orientation="Horizontal" DockPanel.Dock="Bottom" Minimum="0" Maximum="{TemplateBinding ScrollViewer.ScrollableWidth}" Value="{TemplateBinding ScrollViewer.HorizontalOffset}" ViewportSize="{TemplateBinding ScrollViewer.ViewportWidth}" Name="PART_HorizontalScrollBar" Visibility="{TemplateBinding ScrollViewer.ComputedHorizontalScrollBarVisibility}"/>
<ContentPresenter Content="{TemplateBinding ScrollViewer.Content}" />
</DockPanel>
</ControlTemplate>
</ScrollViewer.Template>
<StackPanel Name="sp1">
<Button Click="But_right_click">Button 1</Button>
<Button>Button 2</Button>
<Button>Button 3</Button>
<Button>Button 4</Button>
<Button>Button 5</Button>
<Rectangle Width="700" Height="500" Fill="Purple"/>
<TextBlock>Rectangle 1</TextBlock>
<Rectangle Width="700" Height="500" Fill="Red"/>
<TextBlock>Rectangle 2</TextBlock>
<Rectangle Width="700" Height="500" Fill="Green"/>
<TextBlock>Rectangle 3</TextBlock>
adow
|
初学一级
|
园豆:
70
提问于:2008-01-24 21:52