myNumericUpDowm.xaml 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <UserControl x:Class="TeamAAS_VP.Controls.myNumericUpDowm"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:TeamAAS_VP.Controls"
  7. xmlns:icon="http://metro.mahapps.com/winfx/xaml/iconpacks"
  8. xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
  9. xmlns:lex="http://wpflocalizeextension.codeplex.com"
  10. lex:LocalizeDictionary.DesignCulture="zh-CN"
  11. lex:ResxLocalizationProvider.DefaultAssembly="TeamAAS-VP"
  12. lex:ResxLocalizationProvider.DefaultDictionary="Lang"
  13. FontFamily="{DynamicResource DefaultFont}">
  14. <UserControl.Triggers>
  15. <EventTrigger RoutedEvent="GotFocus">
  16. <BeginStoryboard>
  17. <Storyboard>
  18. <BooleanAnimationUsingKeyFrames Storyboard.TargetName="SliderPopup"
  19. Storyboard.TargetProperty="IsOpen">
  20. <DiscreteBooleanKeyFrame KeyTime="0"
  21. Value="True" />
  22. </BooleanAnimationUsingKeyFrames>
  23. </Storyboard>
  24. </BeginStoryboard>
  25. </EventTrigger>
  26. <EventTrigger RoutedEvent="LostFocus">
  27. <BeginStoryboard>
  28. <Storyboard>
  29. <BooleanAnimationUsingKeyFrames Storyboard.TargetName="SliderPopup"
  30. Storyboard.TargetProperty="IsOpen">
  31. <DiscreteBooleanKeyFrame KeyTime="0"
  32. Value="False" />
  33. </BooleanAnimationUsingKeyFrames>
  34. </Storyboard>
  35. </BeginStoryboard>
  36. </EventTrigger>
  37. </UserControl.Triggers>
  38. <!--<Viewbox Stretch="Fill">
  39. </Viewbox>-->
  40. <Grid>
  41. <mah:NumericUpDown x:Name="MotorAmplitudeNumeric1"
  42. Style="{StaticResource MahApps.Styles.NumericUpDown.DataGrid.Editing}"
  43. BorderThickness="0,0,0,1"
  44. FontSize="{Binding FontSize, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" />
  45. <Popup x:Name="SliderPopup"
  46. Height="{Binding ElementName=MotorAmplitudeNumeric1, Path=Height}"
  47. PlacementTarget="{Binding ElementName=MotorAmplitudeNumeric1}"
  48. Placement="Bottom"
  49. AllowsTransparency="True"
  50. StaysOpen="False"
  51. Width="150">
  52. <Grid Background="Transparent">
  53. <Border Background="#575757"
  54. CornerRadius="0,0,3,3">
  55. <Slider x:Name="slider2"
  56. Margin="5,2,5,2"
  57. Foreground="#2196f3"
  58. IsSnapToTickEnabled="True"
  59. Maximum="{Binding ElementName=MotorAmplitudeNumeric1, Path=Maximum}"
  60. Minimum="{Binding ElementName=MotorAmplitudeNumeric1, Path=Minimum}"
  61. Value="{Binding ElementName=MotorAmplitudeNumeric1,Path=Value,Mode=TwoWay}" />
  62. </Border>
  63. </Grid>
  64. </Popup>
  65. </Grid>
  66. </UserControl>