|
8 | 8 | xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks" |
9 | 9 | xmlns:viewModels="clr-namespace:NETworkManager.ViewModels" |
10 | 10 | xmlns:converters="clr-namespace:NETworkManager.Converters;assembly=NETworkManager.Converters" |
| 11 | + xmlns:controls="clr-namespace:NETworkManager.Controls;assembly=NETworkManager.Controls" |
11 | 12 | xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" |
12 | 13 | xmlns:settings="clr-namespace:NETworkManager.Settings;assembly=NETworkManager.Settings" |
13 | 14 | xmlns:localization="clr-namespace:NETworkManager.Localization.Resources;assembly=NETworkManager.Localization" |
14 | 15 | xmlns:profiles="clr-namespace:NETworkManager.Profiles;assembly=NETworkManager.Profiles" |
| 16 | + xmlns:wpfHelpers="clr-namespace:NETworkManager.Utilities.WPF;assembly=NETworkManager.Utilities.WPF" |
15 | 17 | xmlns:networkManager="clr-namespace:NETworkManager" |
16 | 18 | mc:Ignorable="d" d:DataContext="{d:DesignInstance viewModels:SNMPHostViewModel}"> |
17 | 19 | <UserControl.Resources> |
18 | 20 | <converters:BooleanReverseToVisibilityCollapsedConverter x:Key="BooleanReverseToVisibilityCollapsedConverter" /> |
19 | 21 | <converters:BooleanToVisibilityCollapsedConverter x:Key="BooleanToVisibilityCollapsedConverter" /> |
20 | 22 | <converters:IntNotZeroToVisibilityCollapsedConverter x:Key="IntNotZeroToVisibilityCollapsedConverter" /> |
21 | 23 | <converters:IntZeroToVisibilityCollapsedConverter x:Key="IntZeroToVisibilityCollapsedConverter" /> |
22 | | - <converters:StringNullOrEmptyToBoolConverter x:Key="StringNullOrEmptyToBoolConverter" /> |
| 24 | + <wpfHelpers:BindingProxy x:Key="BindingProxy" Data="{Binding}" /> |
23 | 25 | </UserControl.Resources> |
24 | 26 | <UserControl.InputBindings> |
25 | 27 | <KeyBinding Key="T" Modifiers="Ctrl" Command="{Binding AddTabCommand}" /> |
|
412 | 414 | <Setter Property="Template"> |
413 | 415 | <Setter.Value> |
414 | 416 | <ControlTemplate> |
415 | | - <Expander IsExpanded="True" |
416 | | - Style="{StaticResource DefaultExpander}"> |
| 417 | + <controls:GroupExpander |
| 418 | + Style="{StaticResource DefaultExpander}" |
| 419 | + StateStore="{Binding Path=DataContext.GroupExpanderStateStore, RelativeSource={RelativeSource AncestorType=ListBox}}" |
| 420 | + GroupName="{Binding Path=(CollectionViewGroup.Name)}"> |
417 | 421 | <Expander.Header> |
418 | 422 | <Grid> |
419 | 423 | <Grid.ColumnDefinitions> |
420 | 424 | <ColumnDefinition Width="*" /> |
421 | 425 | <ColumnDefinition Width="10" /> |
422 | 426 | <ColumnDefinition Width="Auto" /> |
423 | 427 | </Grid.ColumnDefinitions> |
424 | | - <Rectangle Grid.Column="0" Grid.ColumnSpan="4" |
| 428 | + <Grid.ContextMenu> |
| 429 | + <ContextMenu |
| 430 | + Style="{StaticResource DefaultContextMenu}"> |
| 431 | + <MenuItem |
| 432 | + Header="{x:Static Member=localization:Strings.ExpandAll}" |
| 433 | + Command="{Binding Path=Data.(viewModels:SNMPHostViewModel.ExpandAllProfileGroupsCommand), Source={StaticResource BindingProxy}}"> |
| 434 | + <MenuItem.Icon> |
| 435 | + <Rectangle Width="16" Height="16" |
| 436 | + Fill="{DynamicResource ResourceKey=MahApps.Brushes.Gray3}"> |
| 437 | + <Rectangle.OpacityMask> |
| 438 | + <VisualBrush |
| 439 | + Stretch="Uniform" |
| 440 | + Visual="{iconPacks:Material Kind=PlusBoxMultipleOutline}" /> |
| 441 | + </Rectangle.OpacityMask> |
| 442 | + </Rectangle> |
| 443 | + </MenuItem.Icon> |
| 444 | + </MenuItem> |
| 445 | + <MenuItem |
| 446 | + Header="{x:Static Member=localization:Strings.CollapseAll}" |
| 447 | + Command="{Binding Path=Data.(viewModels:SNMPHostViewModel.CollapseAllProfileGroupsCommand), Source={StaticResource BindingProxy}}"> |
| 448 | + <MenuItem.Icon> |
| 449 | + <Rectangle Width="16" Height="16" |
| 450 | + Fill="{DynamicResource ResourceKey=MahApps.Brushes.Gray3}"> |
| 451 | + <Rectangle.OpacityMask> |
| 452 | + <VisualBrush |
| 453 | + Stretch="Uniform" |
| 454 | + Visual="{iconPacks:Material Kind=MinusBoxMultipleOutline}" /> |
| 455 | + </Rectangle.OpacityMask> |
| 456 | + </Rectangle> |
| 457 | + </MenuItem.Icon> |
| 458 | + </MenuItem> |
| 459 | + </ContextMenu> |
| 460 | + </Grid.ContextMenu> |
| 461 | + <Rectangle Grid.Column="0" Grid.ColumnSpan="3" |
425 | 462 | Fill="Transparent" /> |
426 | 463 | <TextBlock Grid.Column="0" |
427 | 464 | Text="{Binding (CollectionViewGroup.Name)}" |
|
456 | 493 | </Grid> |
457 | 494 | </Expander.Header> |
458 | 495 | <ItemsPresenter /> |
459 | | - </Expander> |
| 496 | + </controls:GroupExpander> |
460 | 497 | </ControlTemplate> |
461 | 498 | </Setter.Value> |
462 | 499 | </Setter> |
|
0 commit comments