CreateProductPage.xaml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <UserControl x:Class="TeamAAS_VP.Views.Product.CreateProductPage"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:prism="http://prismlibrary.com/"
  5. xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
  6. xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
  7. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  8. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  9. xmlns:vm="clr-namespace:TeamAAS_VP.ViewModels.Product"
  10. xmlns:lex="http://wpflocalizeextension.codeplex.com"
  11. xmlns:sys="clr-namespace:System;assembly=mscorlib"
  12. lex:LocalizeDictionary.DesignCulture="zh-CN"
  13. lex:ResxLocalizationProvider.DefaultAssembly="TeamAAS-VP"
  14. lex:ResxLocalizationProvider.DefaultDictionary="Lang"
  15. prism:ViewModelLocator.AutoWireViewModel="True"
  16. mc:Ignorable="d"
  17. d:DataContext="{d:DesignInstance Type=vm:CreateProductPageViewModel}"
  18. Name="createpro"
  19. FontFamily="{DynamicResource DefaultFont}">
  20. <UserControl.Resources>
  21. <!-- Unified sizing and spacing -->
  22. <Thickness x:Key="OuterPadding">18</Thickness>
  23. <Thickness x:Key="ControlMargin">0,10,0,0</Thickness>
  24. <sys:Double x:Key="TitleFontSize">20</sys:Double>
  25. <sys:Double x:Key="ControlFontSize">15</sys:Double>
  26. <sys:Double x:Key="ControlHeight">44</sys:Double>
  27. <sys:Double x:Key="ControlMaxWidth">520</sys:Double>
  28. <CornerRadius x:Key="PanelCorner">10</CornerRadius>
  29. <!-- Button style based on MaterialDesign flat button but tuned -->
  30. <Style x:Key="ActionButtonStyle" TargetType="Button" BasedOn="{StaticResource MaterialDesignFlatButton}">
  31. <Setter Property="MinWidth" Value="110"/>
  32. <Setter Property="FontSize" Value="{StaticResource ControlFontSize}"/>
  33. <Setter Property="Padding" Value="12,6"/>
  34. </Style>
  35. </UserControl.Resources>
  36. <b:Interaction.Triggers>
  37. <b:EventTrigger EventName="Loaded">
  38. <b:InvokeCommandAction Command="{Binding LoadedCommand}" />
  39. </b:EventTrigger>
  40. </b:Interaction.Triggers>
  41. <Grid Background="Transparent">
  42. <Border Background="White"
  43. CornerRadius="{StaticResource PanelCorner}"
  44. Padding="20"
  45. HorizontalAlignment="Center"
  46. MaxWidth="{StaticResource ControlMaxWidth}"
  47. Effect="{DynamicResource MaterialDesignElevationShadow4}">
  48. <StackPanel HorizontalAlignment="Stretch">
  49. <TextBlock Text="{lex:Loc 新建产品}"
  50. FontSize="{StaticResource TitleFontSize}"
  51. FontWeight="SemiBold"
  52. Margin="0,0,0,8"/>
  53. <!-- Name input -->
  54. <TextBox x:Name="txtName"
  55. Margin="{StaticResource ControlMargin}"
  56. materialDesign:HintAssist.Hint="{lex:Loc 请输入产品名称}"
  57. materialDesign:HintAssist.IsFloating="True"
  58. FontSize="{StaticResource ControlFontSize}"
  59. Height="{StaticResource ControlHeight}"
  60. Style="{StaticResource MaterialDesignFloatingHintTextBox}"
  61. Text="{Binding ProductName,Mode=TwoWay}" />
  62. <!-- Template selection -->
  63. <ComboBox Margin="{StaticResource ControlMargin}"
  64. FontSize="{StaticResource ControlFontSize}"
  65. Height="{StaticResource ControlHeight}"
  66. materialDesign:HintAssist.Hint="{lex:Loc 模板}"
  67. materialDesign:HintAssist.IsFloating="True"
  68. materialDesign:HintAssist.HelperText="{lex:Loc 选择一个模板}"
  69. Style="{StaticResource MaterialDesignFloatingHintComboBox}"
  70. ItemsSource="{Binding Templates}"
  71. SelectedItem="{Binding SelectTemplate}"
  72. MaxWidth="{StaticResource ControlMaxWidth}" />
  73. <TextBlock Text="{lex:Loc 请填写产品名称并选择对应模板}"
  74. FontSize="12"
  75. Foreground="{DynamicResource MaterialDesignBodySecondary}"
  76. Margin="0,12,0,0"/>
  77. <StackPanel Orientation="Horizontal"
  78. HorizontalAlignment="Center"
  79. Margin="0,18,0,0">
  80. <Button FontSize="{StaticResource ControlFontSize}"
  81. Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}"
  82. CommandParameter="{Binding ElementName=createpro,Path=DataContext}"
  83. IsDefault="True"
  84. Style="{StaticResource ActionButtonStyle}"
  85. Content="{lex:Loc 确定}"
  86. Margin="0,0,12,0" />
  87. <Button Margin="0"
  88. FontSize="{StaticResource ControlFontSize}"
  89. Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}"
  90. IsCancel="True"
  91. Style="{StaticResource ActionButtonStyle}"
  92. Content="{lex:Loc 取消}">
  93. <Button.CommandParameter>
  94. <x:Null />
  95. </Button.CommandParameter>
  96. </Button>
  97. </StackPanel>
  98. </StackPanel>
  99. </Border>
  100. </Grid>
  101. </UserControl>