Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. HideShowSingleWindow
  2.  
  3. <Grid>
  4. <tb:TaskbarIcon
  5. IconSource="/Icons/main.ico"
  6. ToolTipText="SCADA Control Center"
  7. DoubleClickCommand="{Binding Path=HideShow}">
  8. <tb:TaskbarIcon.ContextMenu>
  9. <ContextMenu>
  10. <ContextMenu.ItemsSource>
  11. <CompositeCollection>
  12. <MenuItem Header="Windows" ItemsSource="{Binding Path=RegisteredWindows}">
  13. <MenuItem.ItemContainerStyle>
  14. <Style TargetType="{x:Type MenuItem}">
  15. <Setter Property="Header" Value="{Binding Path=Title}" />
  16. <Setter Property="IsCheckable" Value="True" />
  17. <Setter Property="IsChecked" Value="{Binding Path=IsLoaded, Mode=OneWay}"/>
  18. <Setter Property="Command" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ContextMenu}}, Path=HideShowSingleWindow}" />
  19. <Setter Property="CommandParameter" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ContextMenu}}, Path=PlacementTarget.SelectedItem}" />
  20. </Style>
  21. </MenuItem.ItemContainerStyle>
  22. </MenuItem>
  23. <MenuItem Header="Show/Hide All" Command="{Binding Path=HideShow}" />
  24. <Separator />
  25. <MenuItem Header="Exit" Command="{Binding Path=Quit}" />
  26. </CompositeCollection>
  27. </ContextMenu.ItemsSource>
  28. </ContextMenu>
  29. </tb:TaskbarIcon.ContextMenu>
  30. </tb:TaskbarIcon>
  31. </Grid>
  32.  
  33. <Setter Property="Command" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ContextMenu}}, Path=HideShowSingleWindow}" />
  34.  
  35. <Setter Property="Command"
  36. Value="{Binding RelativeSource={RelativeSource FindAncestor,
  37. AncestorType={x:Type ContextMenu}},
  38. Path=PlacementTarget.DataContext.HideShowSingleWindow}"/>
  39.  
  40. <Setter Property="Command" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type tb:TaskbarIcon}}, Path=DataContext.HideShowSingleWindow}" />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement