开发工具
Visual Studio
WPF
布局中的一些使用问题
布局
Grid:Grid是一个二维布局容器,可以将控件按照行和列进行排列。
StackPanel:StackPanel是一个一维布局容器,可以将控件按照垂直或水平方向进行排列。
Canvas:Canvas是一个坐标布局容器,可以将控件按照指定的坐标位置进行放置。
WrapPanel:WrapPanel是一个自动换行的布局容器,可以将控件在垂直或水平方向上自动换行。
Dock:Dock是一个停靠布局容器,可以将控件停靠在窗口的左边、右边、上边或下边。
relative:Relative是一个相对布局容器,可以将控件相对于其父控件或兄弟控件进行定位。
<Window>
//最外层容器
//让整个容器变成圆角
<Window.Clip>
<RectangleGeometry Rect="0,0,857,483" RadiusX="25" RadiusY="25"/>
</Window.Clip>
</Window
//ScrollViewer 需要滚动条的时候使用
<ScrollViewer VerticalScrollBarVisibility="auto" Padding="10,0">
</ScrollViewer>
//Border 由于Grid、stackPanel、WrapPanel没有边框,所以需要用到Border来当边框的容器。
<Border BorderThickness="0,1,1,1" BorderBrush="#FFE9EBF6">
</Border >
//Grid 表格的形式布局。
<Grid Margin="0 0 0 0" Background="#F6F7FB" >
</Grid >
//WrapPanel 有点类似DIV,有Orientation属性可以设置垂直水平布局,比tackPanel级别高点。
<WrapPanel Margin="0 0 0 0" Background="#F6F7FB" >
</WrapPanel>
相应式布局
//想类似DIV一样垂直布局需要先使用一个WrapPanel 包住垂直布局,里面的元素才可以不堆叠在一起。
<WrapPanel Orientation="Vertical" Width="800">
<StackPanel Orientation="Horizontal">
<Label Content="*" />
<Label Content="模型名称:" FontSize="16"/>
<TextBox x:Name="ModeNameTextBox" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label Content="*" />
<Label Content="模型名称:" FontSize="16"/>
<TextBox x:Name="ModeNameTextBox" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label Content="*" />
<Label Content="模型名称:" FontSize="16"/>
<TextBox x:Name="ModeNameTextBox" />
</StackPanel>
</WrapPanel>
自适应遇到的宽度问题
要使WPF容器的的大小为100%,您需要设置容器的宽度和高度属性为“填充父级容器”或“父级容器大小”其中,ParentCtrl是父级容器的名称。通过这种方式,Grid将自动填充其父级容器的大小,并且当父级容器的大小更改时,Grid的大小将自动调整。
<WrapPanel Name="ParentCtrl">
<Grid Grid.Row="1" Grid.Column="1" Width="{Binding ActualWidth, ElementName=ParentCtrl}" Height="{Binding ActualHeight, ElementName=ParentCtrl}">
<!-- content here -->
</Grid>
</WrapPanel>
window
<!– window背景图片的使用 -->
<Window
Title="ChipTest"
Height="600"
Width="900"
WindowStartupLocation="CenterScreen"
WindowState="Maximized"
Cursor=""
Closing="Window_Closing"
Background="#ffffffff"
>
<!– 使用背景图片 -->
<Window.Background>
<ImageBrush ImageSource ="Image\zhuce.png"/>
</Window.Background>
</Window>
Grid
常用的布局是Grid,内容再根据布局来填写位置
<Grid Background="LightGray" Margin="10">
//设置行
<Grid.RowDefinitions>
//这里设置每一行参数
<RowDefinition Height = "*" />
<RowDefinition Height = "*" />
<RowDefinition Height = "*" />
<RowDefinition Height = "*" />
<RowDefinition Height = "*" />
</Grid.RowDefinitions>
//设置列
<Grid.ColumnDefinitions>
//这里设置每一列参数
<ColumnDefinition Width = "*" />
</Grid.ColumnDefinitions>
//网格中的内容
<Button Content="Button 1" Grid.Row="0" Grid.Column="0" Background="Red" />
<TextBlock Text="Text Block 1" Grid.Row="0" Grid.Column="1" TextAlignment="Center" FontSize="16" Margin="5" />
</Grid>
常用的属性:
Background:设置Grid的背景色。
Margin:设置Grid的外边距,即与相邻元素的距离。
ColumnDefinitions:定义Grid的列。在本例中,我们定义了三列,其中第一列和第三列的宽度为“”(自动调整),中间列的宽度为“Auto”(根据内容自适应)。
RowDefinitions:定义Grid的行。在本例中,我们定义了三行,其中第一行和第三行的宽度为“”(自动调整),中间行的宽度为“Auto”(根据内容自适应)。
Grid.Row 和 Grid.Column:指定控件所在的行和列。在本例中,我们使用这些属性将每个按钮和文本块定位到不同的单元格。
Background:设置控件的背景色。
TextAlignment:设置文本块的文本对齐方式。在本例中,我们将其设置为居中对齐。
FontSize:设置文本块的字体大小。
Margin:设置文本块的外边距,即与相邻元素的距离。
不过没有边框设置,需要边框时得在里层加个<border/>,或者使用图片做背景的时候也需要用到。
<!– 背景图片的使用 -->
<Grid Margin="-1,0,1,0" ShowGridLines="True" >
<!– 使用背景图片 -->
<Border BorderBrush="Transparent" BorderThickness="0">
<Image Source="Image\zhuce.png" Stretch="Uniform"/>
</Border>
</Window>
其中ShowGridLines="True" 是显示布局的线,一般用来检查的。
StackPanel
常用的水平排版容器
StackPanel是XAML中的一个布局控件,用于将元素以垂直或水平方向堆叠在一起。
<StackPanel Orientation="Horizontal">
<Button Content="Button 1" />
<Button Content="Button 2" />
</StackPanel>
属性:
Orientation:指定元素的堆叠方向。可选值为Vertical(垂直)和Horizontal(水平)。默认为Vertical。
Children:包含StackPanel的子元素。可以通过添加子元素来在StackPanel中放置其他控件。
ItemSpacing:设置StackPanel中元素之间的间距。默认值为0。
FlowDirection:设置StackPanel中元素的排列方向。可选值为LeftToRight(从左到右)和RightToLeft(从右到左)。默认为LeftToRight。
样式的用法
Image图片
图片的用法有点特别,首先图片需要设置图片的属性,“生成操作”设置为资源(resource),“复制到输出目录”为“始终复制”
1、jpg/png
<!– 图片-->
<Image Stretch="Uniform" Source="images/example.png" MouseDown="Image_MouseDown" MouseUp="Image_MouseUp" MouseMove="Image_MouseMove"/>
Source 属性:指定图片的源文件路径或 URL。可以使用相对路径或绝对路径。
Stretch 属性:指定图片的拉伸方式。可以使用以下值之一:
None:不拉伸图片,保持其原始大小。
Uniform:将图片按相同比例拉伸,以适应控件的大小。
UniformToFill:将图片按相同比例拉伸,以填充控件,但保持图片的纵横比。
Fill:将图片放大或缩小以填充控件,不保持图片的纵横比。
Alignment 属性:指定图片在容器中的对齐方式。可以使用以下值之一:
TopLeft:将图片顶部对齐,左对齐。
TopCenter:将图片顶部对齐,水平居中对齐。
TopRight:将图片顶部对齐,右对齐。
CenterLeft:将图片水平居中对齐,左对齐。
Center:将图片水平居中对齐,垂直居中对齐。
CenterRight:将图片水平居中对齐,右对齐。
BottomLeft:将图片底部对齐,左对齐。
BottomCenter:将图片底部对齐,水平居中对齐。
BottomRight:将图片底部对齐,右对齐。
PointerEntered 和 PointerExited 事件:用于在鼠标进入或离开图片时触发相应的事件处理程序。
MouseDown、MouseUp、MouseMove 等事件:用于在鼠标按下、松开或移动时触发相应的事件处理程序。
Tag 属性:用于存储与图片相关的自定义数据。可以在事件处理程序中访问该属性。
2、GIF图片
1、<!– 安装XamlAnimatedGif库 -->
第一步 使用Nuget安装XamlAnimatedGif包
2、<!– xaml界面引用XamlAnimatedGif库 -->
xmlns:gif="https://github.com/XamlAnimatedGif/XamlAnimatedGif"
3、<!– xaml -->
<Image gif:AnimationBehavior.SourceUri="Resources/loading.gif" Width="50" Height="50"></Image>
SVG图片
这个示例也是在按钮中增加SVG图标
1、<!– 安装SharpVectors库 -->
第一步 使用Nuget安装sharpvectors包
2、<!– 页面引入SharpVectors库 -->
xmlns:svgc = "http://sharpvectors.codeplex.com/svgc/"
3、<!– 页面以svgc的标签加入SVG图片 -->
<Button Width="150" Height="30" Background="#FF6C83F7" Foreground="White">
<WrapPanel Height="30" Width="150">
<svgc:SvgViewbox IsHitTestVisible="False" Source="Resources/新增.svg" Margin="20 2 10 0" Width="20" Height="20"/>
<TextBlock TextWrapping="Wrap" Text="新建模型" Width="90" FontSize="14" VerticalAlignment="Center" Padding="10,0,0,0" HorizontalAlignment="Left" Margin="-4,0,0,0"/>
</WrapPanel>
</Button>
常用表单
//CS
<WrapPanel Orientation="Vertical" Width="800">
//单选
<StackPanel Orientation="Horizontal" Margin="100,0,0,0">
<Label Content="*" Margin="0,0,0,0" Foreground="Red"/>
<Label Content="算法名称:" />
<RadioButton x:Name="ImageClassificationRadioButton" Content="图像分类" Margin="0,5,0,0" />
<RadioButton x:Name="DataClassificationRadioButton" Content="数据分类" Margin="20,5,0,0" />
<RadioButton x:Name="UnsupervisedLearningRadioButton" Content="无监督学习" Margin="20,5,0,0" />
</StackPanel>
//输入框
<StackPanel Orientation="Horizontal" Margin="100,15,0,0">
<Label Content="*" Margin="0,0,0,0" Foreground="Red"/>
<Label Content="模型名称:" />
<TextBox x:Name="ModeNameTextBox" TextWrapping="Wrap" Text="" Width="500" Height="30" />
</StackPanel>
//文字域
<StackPanel Orientation="Horizontal" Margin="100,15,0,0">
<Label Content="*" Foreground="Red"/>
<Label Content="模型描述:" />
<TextBox x:Name="ModeDescriptionTextBox" TextWrapping="Wrap" Text="" Width="500" Height="100" AcceptsReturn ="True"/>
</StackPanel>
//下拉选项
<StackPanel Orientation="Horizontal" Margin="115,15,0,0">
<Label Content="所属项目:" />
<ComboBox Width="500" Height="30" Padding="5">
<ComboBoxItem Content="项目Title" IsSelected="True" />
</ComboBox>
</StackPanel>
</WrapPanel>
按钮
//按钮的样式设置
<Button Content="+ 马上开始诊断预测" HorizontalAlignment="Center" Margin="0 30 0 0" Width="300" FontSize="18" Height="65" Foreground="White" >
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
//使用border来设置圆角
<Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="0" CornerRadius="5">
//使用样式设置鼠标移过等效果
<Border.Style>
<Style TargetType="Border">
<Setter Property="Background" Value="#545A72"/>
<Setter Property="BorderBrush" Value="Black"/>
<Setter Property="BorderThickness" Value="0"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#799EFF"/>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
</ControlTemplate>
</Button.Template>
</Button>
圆角
//圆角背景
<Window x:Class="ESPCPS.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ESPCPS"
mc:Ignorable="d"
Title="系统" Height="500" Width="800" WindowStyle="None" AllowsTransparency="True" Background="Transparent"
OpacityMask="White"
ResizeMode="NoResize"
MouseMove="Window_MouseMove" >
<Border BorderThickness="1" BorderBrush="Gray" CornerRadius="25,25,25,25">
<Grid Width="800" Margin="0" Height="500" >
<Border BorderThickness="0" CornerRadius="25,25,25,25">
<Border.Background>
<ImageBrush ImageSource="beijing.jpg"/>
</Border.Background>
</Border>
</Grid>
</Border>
</Window>
//容器圆角
<Border CornerRadius="10" Background="#ccc">
<StackPanel>
<TextBlock Text="这是一个圆角的容器" Margin="10"/>
<TextBlock Text="里面可以放置其他控件" Margin="10"/>
</StackPanel>
</Border>
//按钮圆角
<Button x:Name="but1" Content="软件介绍" HorizontalAlignment="Left" Margin="126,356,0,0" VerticalAlignment="Top" Width="128" Click="Button_Click" FontSize="20" Height="35" >
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="1" CornerRadius="10">
<Border.Background>#FF8EB4D4</Border.Background>
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
</ControlTemplate>
</Button.Template>
</Button>
//TextBox圆角
<TextBox HorizontalAlignment="Left" Height="24" Margin="43,192,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="98">
<TextBox.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="8"/>
<Setter Property="BorderBrush" Value="#c1d0dc"/>
</Style>
</TextBox.Resources>
</TextBox>
//PasswordBox设置圆角
<PasswordBox x:Name="t2" HorizontalAlignment="Left" Margin="183,150,0,0" VerticalAlignment="Top" Width="114" Height="26" BorderBrush="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" FontSize="18" Password="
">
<PasswordBox.Resources>
<Style TargetType="PasswordBox">
<Setter Property="PasswordChar" Value="●"/>
<Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="AllowDrop" Value="true"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="PasswordBox">
<Border CornerRadius="8" x:Name="Bd" Background="White" BorderBrush="#c1d0dc" BorderThickness="1" OpacityMask="{x:Null}">
<ScrollViewer SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" x:Name="PART_ContentHost" Template="{DynamicResource ScrollViewerControlTemplate1}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</PasswordBox.Resources>
</PasswordBox>
Style样式的使用
页面上定义样式
<Window >
<Window.Resources>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="#FF545A72" />
<Setter Property="FontSize" Value="14" />
</Style>
<Style TargetType="{x:Type RadioButton}">
<Setter Property="Foreground" Value="#FF545A72" />
<Setter Property="FontSize" Value="14" />
</Style>
<Style TargetType="{x:Type Label}">
<Setter Property="Foreground" Value="#FF545A72" />
<Setter Property="FontSize" Value="14" />
</Style>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="Foreground" Value="#FF545A72" />
<Setter Property="FontSize" Value="14" />
</Style>
<Style TargetType="{x:Type DataGrid}">
<Setter Property="Foreground" Value="#FF545A72" />
<Setter Property="FontSize" Value="14" />
</Style>
</Window.Resources>
</Window >
style在window中使用x:Key="mybutton1"设置,然后在元素中使用Style="{StaticResource mybutton1}"调用。
<Window.Resources>
<!--通用按钮样式-->
<Style TargetType="{x:Type Button}" x:Key="mybutton1">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="0" CornerRadius="5">
<Border.Style>
<Style TargetType="Border">
<Setter Property="Background" Value="#FF377EFF"/>
<Setter Property="BorderBrush" Value="White"/>
<Setter Property="BorderThickness" Value="0"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#799EFF"/>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
XMAL中调用
<Button Style="{StaticResource mybutton1}"/>
关于隐藏的问题
// 设置Grid的可见性为false,使其不可见,而且不占用空间
grid1.Visibility = Visibility.Collapsed;
// 设置Grid的可见性为true,使其可见
grid1.Visibility = Visibility.Visible;
通过设置Grid的Visibility属性来控制其可见性。
通过设置grid1的Visibility属性为Collapsed或Visible,可以控制Grid的可见性。
当isibility属性设置为Collapsed时,Grid控件将不可见,并且不会占用容器空间。
当Visibility属性设置为Visible时,Grid控件将可见,并占用容器空间。
CS常用的一些方法
按钮常用事件
单击
可以做一些类似tabs的一些效果
//XAML
<Button Content="单击" HorizontalAlignment="Center" Click="showDrive" Margin="0 40 0 0" Width="228" FontSize="18" Height="45" Foreground="White" ></Button>
<Grid x:Name="GridName1"></Grid>
<Grid x:Name="GridName2"></Grid>
//CS
private void showDrive(object sender, RoutedEventArgs e)
{
GridName1.Visibility = Visibility.Collapsed;//点击后改变名字为GridName1的元素的可见性
GridName2.Visibility = Visibility.Visible;//点击后改变名字为GridName2的元素的可见性
}
点击弹窗
/* 画布详情-弹窗-文件上传///////////////////////////////////////////////*/
/*文件上传*/
private void CanvasFileUpdate2(object sender, RoutedEventArgs e)
{
CanvasFileUpdate2 cooperate = new CanvasFileUpdate2();
cooperate.Show();
}
测试弹窗打印
<!– 测试弹窗打印-->
MessageBox.Show("常量");
MessageBox.Show(“常量”+变量.ToString());
在.CS中修改样式的方法
//xmal
<TextBlock x:Name="TestabilityLabel" TextWrapping="Wrap" Style="{StaticResource mytextcolor2}" />
//CS
TestabilityLabel.Style = FindResource("mybutton1_s_unable") as Style;
//按条件修改样式
ModelingText.Style = Global.Modeling ? FindResource("mytext") as Style : FindResource("mytext2") as Style;
注意的问题:
1.表格默认单元格的数据是可以编辑的,需要设置 IsReadOnly="True"的属性。
<DataGrid IsReadOnly="True">
2.分栏控制器的头部tabs需要隐藏的话,要设置ShowHeader="False"属性。
<avalon:LayoutDocumentPane x:Name="DocumentPane" ShowHeader="False">
后端修改样式的一些用法
private void EditPassWordButton_Click(object sender, RoutedEventArgs e)
{
ButtonToPassword.Style = (Style)FindResource("mybutton4b");//修改样式名
AccountSettingsButton.Background = new SolidColorBrush(Colors.Transparent);//修改背景
BoxToPassword.Visibility = Visibility.Visible;//修改可见性
BoxToPhone.Visibility = Visibility.Hidden;//修改可见性
}
自定义好看的tabs
设计两种状态的tabs按钮的样式
style
<!--通用按钮样式4-->
<Style TargetType="{x:Type Button}" x:Key="mybutton4">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="0" CornerRadius="5">
<Border.Style>
<Style TargetType="Border">
<Setter Property="Background" Value="#f4f7ff"/>
<Setter Property="BorderBrush" Value="#f4f7ff"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Cursor" Value="Arrow"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#f4f7ff"/>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--通用按钮样式4b-->
<Style TargetType="{x:Type Button}" x:Key="mybutton4b">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="1" CornerRadius="5">
<Border.Style>
<Style TargetType="Border">
<Setter Property="Background" Value="#ffffff"/>
<Setter Property="BorderBrush" Value="#f4f7ff"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Cursor" Value="Hand"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#f4f7ff"/>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
. XMAL
设计按钮控件
<!--tab按钮-->
<WrapPanel x:Name="AccountSettingsGroup1" Orientation="Vertical" Grid.Column="1" Margin="20 0 0 0" HorizontalAlignment="Stretch">
<WrapPanel Orientation="Horizontal">
<Button x:Name="ButtonToPassword" Style="{StaticResource mybutton4}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="235" Height="105" Margin="0 10 -2 0" Background="#f4f7ff" BorderBrush="{x:Null}" Click="EditPassWordButton_Click">
<WrapPanel Height="95" >
<Image Stretch="UniformToFill" Source="Image/iconSet1.png" Height="76" Width="77" Margin="20 5 0 0"/>
<TextBlock TextWrapping="Wrap" Text="修改密码" Width="90" FontSize="12" VerticalAlignment="Center" Padding="10,0,0,0" HorizontalAlignment="Left" Margin="-4,0,0,0"/>
</WrapPanel>
</Button>
<Button x:Name="ButtonToPhone" Style="{StaticResource mybutton4b}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="235" Height="105" Margin="10 10 -2 0" Background="Transparent" BorderBrush="{x:Null}" Click="EditPhomeButton_Click">
<WrapPanel Height="95">
<Image Stretch="UniformToFill" Source="Image/iconSet2.png" Height="86" Width="53" Margin="20 5 0 0"/>
<TextBlock TextWrapping="Wrap" Text="绑定手机" Width="90" FontSize="12" VerticalAlignment="Center" Padding="10,0,0,0" HorizontalAlignment="Left" Margin="-4,0,0,0"/>
</WrapPanel>
</Button>
</WrapPanel>
<Border Margin="0 10 0 0" HorizontalAlignment="Stretch" BorderBrush="#f4f7ff" BorderThickness="0 0 0 1"></Border>
tabs容器代码
<WrapPanel x:Name="PersonalInformationGroup" Grid.Column="1" Orientation="Vertical" HorizontalAlignment="Stretch" >
</WrapPanel>
<WrapPanel x:Name="AccountSettingsGroup1" Orientation="Vertical" Grid.Column="1" Margin="20 0 0 0" HorizontalAlignment="Stretch">
</WrapPanel>
.cs代码
//跳转修改密码
private void EditPassWordButton_Click(object sender, RoutedEventArgs e)
{
ButtonToPassword.Style = (Style)FindResource("mybutton4");
ButtonToPhone.Style = (Style)FindResource("mybutton4b");
BoxToPassword.Visibility = Visibility.Visible;
BoxToPhone.Visibility = Visibility.Collapsed;
}
//跳转修改电话
private void EditPhomeButton_Click(object sender, RoutedEventArgs e)
{
ButtonToPassword.Style = (Style)FindResource("mybutton4b");
ButtonToPhone.Style = (Style)FindResource("mybutton4");
BoxToPassword.Visibility = Visibility.Collapsed;
BoxToPhone.Visibility = Visibility.Visible;
}