소스 검색

добавили шаблоны элементов управления

fly9024 1 년 전
부모
커밋
ff19e4e7cd
5개의 변경된 파일30개의 추가작업 그리고 5개의 파일을 삭제
  1. 1 1
      MyWpfApp/App.config
  2. 11 1
      MyWpfApp/App.xaml
  3. 6 0
      MyWpfApp/Pages/Auth.xaml
  4. 7 0
      MyWpfApp/Pages/Auth.xaml.cs
  5. 5 3
      MyWpfApp/Pages/PageUserInfo.xaml

+ 1 - 1
MyWpfApp/App.config

@@ -8,7 +8,7 @@
     <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
   </startup>
   <connectionStrings>
-    <add name="Smerdova_PPEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=ngknn.ru;initial catalog=Smerdova_PP;persist security info=True;user id=21P;password=12357;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
+    <add name="Smerdova_PPEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=sql.ngknn.local;initial catalog=Smerdova_PP;persist security info=True;user id=21P;password=12357;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
   </connectionStrings>
   <entityFramework>
     <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">

+ 11 - 1
MyWpfApp/App.xaml

@@ -34,6 +34,16 @@
             <Setter Property="Background" Value="Bisque"/>
         </Style>
 
-
+        <ControlTemplate TargetType="Button" x:Key="Template1">
+            <Border BorderBrush="Aqua" BorderThickness="3" x:Name="border">
+                <ContentControl Content="{TemplateBinding Content}"/>
+            </Border>
+            <ControlTemplate.Triggers>
+                <Trigger Property="IsMouseOver" Value="true">
+                    <Setter TargetName="border" Property="BorderThickness" Value="10"/>
+                </Trigger>
+            </ControlTemplate.Triggers>
+        </ControlTemplate>
+       
     </Application.Resources>
 </Application>

+ 6 - 0
MyWpfApp/Pages/Auth.xaml

@@ -8,6 +8,8 @@
       d:DesignHeight="450" d:DesignWidth="800"
       Title="Auth">
 
+    
+
     <Grid>
         <GroupBox Header="Регистрационные данные">
             <StackPanel>
@@ -18,6 +20,10 @@
                     <PasswordBox Name="TxtPassword"/>
                 </GroupBox>
                 <Button Content="Войти" Name="btnEnter" IsDefault="True" Click="btnEnter_Click"/>
+                <TextBlock x:Name="txtTitle" Text="Заголовок этой страницы"/>
+                <Button Template="{StaticResource Template1}" Click="Button_Click" Content="{Binding Text,ElementName=txtTitle}"/>
+               
+                
             </StackPanel>            
         </GroupBox>
     </Grid>

+ 7 - 0
MyWpfApp/Pages/Auth.xaml.cs

@@ -52,5 +52,12 @@ namespace MyWpfApp.Pages
                 MessageBox.Show("Вы не зарегистрированы");
             }
         }
+
+        private void Button_Click(object sender, RoutedEventArgs e)
+        {
+            MessageBox.Show("Сработало");
+        }
+
+        
     }
 }

+ 5 - 3
MyWpfApp/Pages/PageUserInfo.xaml

@@ -26,9 +26,11 @@
             <GroupBox Header="Роль пользователя">
                 <ComboBox Name="CBRoles" SelectedValue="{Binding LoginedTable.IDRole}"/>
             </GroupBox>
-            
-            
-            
+
+            <TextBlock x:Name="txtTitle" Text="Заголовок той страницы"/>
+            <Button Template="{StaticResource Template1}"  Content="{Binding Text,ElementName=txtTitle}"/>
+
+
             <Button Content="Сохранить изменения" Name="BtnSave" Click="BtnSave_Click"/>
             <Button Content="Назад" Name="BtnBack" Click="BtnBack_Click"/>
         </StackPanel>