Q
我需要WPF 4
2
A
回答
4
是,該工具包中手風琴與.NET完全兼容4
1
是的手風琴控件與.NET 4下面是介紹如何使用它的一篇文章:
1
我們爲擴展器的部分創建了一個ListBox的自定義樣式。這使我們可以通過簡單地設計擴展器樣式來自定義菜單項的外觀和風格(即彙總按鈕,當無效時爲紅色等)。下面是一個代碼片段,可以作爲起點,您可以自定義它以適合您需要。注意:使用IsSelected綁定IsExpanded使其一次只能打開一個擴展器,如果想要一次打開多個擴展器,只需將其刪除即可。
<Style x:Key="VerticalListBoxWithAutoScroll" TargetType="{x:Type ListBox}">
<Setter Property="SnapsToDevicePixels" Value="true"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Grid>
<ScrollViewer x:Name="scrollviewer">
<ScrollViewer.Template>
<ControlTemplate TargetType="{x:Type ScrollViewer}" >
<Grid >
<ScrollBar x:Name="PART_VerticalScrollBar" Orientation="Vertical"
Value="{TemplateBinding VerticalOffset}"
Maximum="{TemplateBinding ScrollableHeight}"
ViewportSize="{TemplateBinding ViewportHeight}"
Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
Width="{Binding Width, ElementName=Panel}">
<ScrollBar.Template>
<ControlTemplate>
<Track x:Name="PART_Track">
<Track.DecreaseRepeatButton>
<RepeatButton Command="ScrollBar.PageUpCommand"
Background="White" BorderBrush="Transparent"/>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Command="ScrollBar.PageDownCommand"
Background="White" BorderBrush="Transparent"/>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb BorderBrush="Transparent"
Background="White" Opacity="0.8" />
</Track.Thumb>
</Track>
</ControlTemplate>
</ScrollBar.Template>
</ScrollBar>
<ScrollContentPresenter Height="Auto" VerticalAlignment="Center"/>
</Grid>
</ControlTemplate>
</ScrollViewer.Template>
<ItemsPresenter/>
</ScrollViewer>
<Grid x:Name="Panel">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<RepeatButton Grid.Row="0" x:Name="LineUpButton" Height="30" Width="80" HorizontalAlignment="Center" Opacity="0" Visibility="Collapsed"
Style="{StaticResource ScrollBarLineButton}"
Content="M 0 8 L 8 8 L 4 0 Z"
Command="{x:Static ScrollBar.LineUpCommand}"
CommandTarget="{Binding ElementName=scrollviewer}"
ClickMode="Hover" />
<RepeatButton Grid.Row="2" x:Name="LineDownButton" Height="30" Width="80" HorizontalAlignment="Center" Opacity="0" Visibility="Collapsed"
Style="{StaticResource ScrollBarLineButton}"
Content="M 0 0 L 4 8 L 8 0 Z"
Command="{x:Static ScrollBar.LineDownCommand}"
CommandTarget="{Binding ElementName=scrollviewer}"
ClickMode="Hover"/>
</Grid>
</Grid>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True"/>
<Condition Property="ComputedVerticalScrollBarVisibility" SourceName="scrollviewer" Value="Visible"/>
</MultiTrigger.Conditions>
<MultiTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="LineUpButton"
Storyboard.TargetProperty="Opacity" To="0.8" Duration="0:0:0.25"/>
<DoubleAnimation Storyboard.TargetName="LineDownButton"
Storyboard.TargetProperty="Opacity" To="0.8" Duration="0:0:0.25"/>
</Storyboard>
</BeginStoryboard>
</MultiTrigger.EnterActions>
<MultiTrigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="LineUpButton"
Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.25"/>
<DoubleAnimation Storyboard.TargetName="LineDownButton"
Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.25"/>
</Storyboard>
</BeginStoryboard>
</MultiTrigger.ExitActions>
<Setter TargetName="LineUpButton" Property="Visibility" Value="Visible" />
<Setter TargetName="LineDownButton" Property="Visibility" Value="Visible" />
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="ItemTemplate">
<Setter.Value >
<DataTemplate>
<StackPanel Background="White">
<Expander Content="{Binding}" Width="Auto" Header="{Binding DisplayName}"
IsExpanded="{Binding IsSelected, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListBoxItem}}}" >
</Expander>
</StackPanel>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
相關問題
- 1. 我需要OCR爲WPF
- 2. 需要對WPF
- 3. 我需要這樣的Wpf樹視圖
- 4. 如何通知用戶需要安裝.NET 4的XCOPY WPF 4應用程序?
- 5. 我需要4-4-3的團體出這個shuffledClassroom名單
- 6. 我需要加快我的WPF的演出節目
- 7. Silverlight 4是否需要.NET 4?
- 8. MYSQL Query需要4小時
- 9. MEF是否需要.NET 4?
- 10. 需要加入4個表
- 11. Silverlight 4需要SilverlightFaultBehavior類嗎?
- 12. Angular 4 - * ngComponentOutlet澄清需要
- 13. iOS 4需要UIPrerenderedIcon嗎?
- 14. Ext JS 4:需要什麼?
- 15. MSDeploy是否需要.net 4?
- 16. 需要WPF MediaElement包裝
- 17. 爲什麼WPF需要AutomationProperties
- 18. 需要Wpf相當於SystemInformation.DragSize
- 19. 需要WPF呈現提示
- 20. WPF需要有關面板
- 21. 是WPF需要學習XAML
- 22. WPF:需要一個幾乎「隱形」的TabControl。我需要重寫什麼?
- 23. 爲什麼Python需要永遠評估1 ** 4 ** 4 ** 4 ** 4?
- 24. 我具有矩陣12 * 4,我需要減去作爲不同
- 25. 我想要當WPF
- 26. 我要顯示WPF
- 27. WPF MVVM,我需要把我的轉換器?
- 28. 需要幫助wpf應用程序需要5盒的總和
- 29. 我需要在SQL
- 30. 我需要phpMyAdmin嗎?
Thanks Bas,我已經添加了WPF Toolkit dll引用以及xml命名空間並開始使用Accordion。但它似乎沒有正確顯示: – leinad13 2011-05-12 14:41:22
[鏈接] http://www1.picturepush.com/photo/a/5641074/220/5641074.png – leinad13 2011-05-12 14:47:10
我認爲這是預期的行爲,如果你不喜歡外觀您可以更改控件模板。 – Bas 2011-05-14 11:24:26