当前位置: 首页 > wzjs >正文

mac xampp wordpress 建立数据库连接时出错上海网络营销seo

mac xampp wordpress 建立数据库连接时出错,上海网络营销seo,谷歌外贸平台,商城网站建设哪家便宜这里以lepoco的wpf-ui为例 nuget上的包基本是开源的,但是除非是离线环境,否则不建议将包源码直接放到工程里。 下面的修改示例是针对直接使用nuget包的。 方法一、通过定义相同资源覆盖原始资源 例如修改ListBox选中项的背景颜色 首先我们在界面上添…

这里以lepoco的wpf-ui为例

nuget上的包基本是开源的,但是除非是离线环境,否则不建议将包源码直接放到工程里。

下面的修改示例是针对直接使用nuget包的。

方法一、通过定义相同资源覆盖原始资源

例如修改ListBox选中项的背景颜色

首先我们在界面上添加一个ListBox,并添加几项

1   <ListBox>
2       <ListBoxItem>22222</ListBoxItem>
3       <ListBoxItem>33333</ListBoxItem>
4       <ListBoxItem>44444</ListBoxItem>
5   </ListBox>

运行效果如下

如果我们想修改选中的颜色,最简单的方案就是创建一个跟控件库中一样名字的SolidColorBrush资源即可。

我们打开wpf-ui包的源码,搜索ListBoxItem.xaml,然后找到这个资源名称,创建一个一样的即可。

 1  <Application.Resources>2      <ResourceDictionary>3          <ResourceDictionary.MergedDictionaries>4              5              <ui:ThemesDictionary Theme="Light" />6              <ui:ControlsDictionary />7              8              <!--创建一个名称一样的资源即可-->9              <ResourceDictionary>
10                  <SolidColorBrush x:Key="ListBoxItemSelectedBackgroundThemeBrush" Color="Red"></SolidColorBrush>
11              </ResourceDictionary>
12          </ResourceDictionary.MergedDictionaries>
13      </ResourceDictionary>
14  </Application.Resources>

运行效果

方法二、动态修改控件模板

例如我们要修改Button的圆角。

首先我们在界面上放置一个Button

1   <Button Grid.Row="1" Content="Hello World" HorizontalAlignment="Center" VerticalAlignment="Center" Width="108" Height="38" Name="btn" Click="btn_Click"></Button>

然后我们想修改Button为圆角,

只需要找到Button.xaml,然后找到Button的控件模板,找到设置圆角的Border元素,并复制名称

然后通过代码修改CornerRadius

1   private void btn_Click(object sender, RoutedEventArgs e)
2   {
3       var borderObj = btn.Template.FindName("ContentBorder", btn);
4 
5       if(borderObj != null && borderObj is Border border)
6       {
7           border.CornerRadius = new CornerRadius(10);
8       }
9   }

运行效果如下:

方法三、通过继承样式,并设置控件模板

例如,当鼠标划过一个Button时,背景颜色通过动画变成Pink

我们找到Button.xaml,找到Button的样式名称

 然后我们新建一个样式,继承自DefaultButtonStyle,再修改控件模板即可,这样我们能继承大部分的样式效果

 1       <Button Content="HelloWorld" HorizontalAlignment="Center" VerticalAlignment="Center">2           <Button.Style>3               <Style TargetType="{x:Type Button}" BasedOn="{StaticResource DefaultButtonStyle}">4                   <Setter Property="Template">5                       <Setter.Value>6                           <ControlTemplate TargetType="{x:Type Button}">7                               <Border8                  x:Name="ContentBorder"9                  Width="{TemplateBinding Width}"
10                  Height="{TemplateBinding Height}"
11                  MinWidth="{TemplateBinding MinWidth}"
12                  MinHeight="{TemplateBinding MinHeight}"
13                  Padding="{TemplateBinding Padding}"
14                  HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
15                  VerticalAlignment="{TemplateBinding VerticalAlignment}"
16                  Background="{TemplateBinding Background}"
17                  BorderBrush="{TemplateBinding BorderBrush}"
18                  BorderThickness="{TemplateBinding BorderThickness}"
19                  CornerRadius="{TemplateBinding Border.CornerRadius}">
20                                   <ContentPresenter
21                      x:Name="ContentPresenter"
22                      HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
23                      VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
24                      Content="{TemplateBinding Content}"
25                      ContentTemplate="{TemplateBinding ContentTemplate}"
26                      TextElement.Foreground="{TemplateBinding Foreground}" />
27                               </Border>
28                               <ControlTemplate.Triggers>
29                                   <Trigger Property="IsPressed" Value="True">
30                                       <Setter Property="BorderBrush" Value="Silver" />
31                                   </Trigger>
32                                   <EventTrigger RoutedEvent="MouseEnter">
33                                       <BeginStoryboard>
34                                           <Storyboard>
35                                               <ColorAnimation Storyboard.TargetName="ContentBorder" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" To="Pink" Duration="0:0:0.5"></ColorAnimation>
36                                           </Storyboard>
37                                       </BeginStoryboard>
38                                   </EventTrigger>
39                                   <EventTrigger RoutedEvent="MouseLeave">
40                                       <BeginStoryboard>
41                                           <Storyboard>
42                                               <ColorAnimation Storyboard.TargetName="ContentBorder" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" From="Pink" Duration="0:0:0.5"></ColorAnimation>
43                                           </Storyboard>
44                                       </BeginStoryboard>
45                                   </EventTrigger>
46                               </ControlTemplate.Triggers>
47                           </ControlTemplate>
48                       </Setter.Value>
49                   </Setter>
50               </Style>
51           </Button.Style>
52       </Button>

运行效果如下:

示例代码

下载

http://www.dtcms.com/wzjs/389540.html

相关文章:

  • 做外贸用什么视频网站好百度seo排名优化公司哪家好
  • html5高端网站建设织梦模板下载使用最佳搜索引擎优化工具
  • 深圳做棋牌网站建设哪家公司收费合理关键词有哪几种
  • 夸克建站系统源码下载关键词优化话术
  • 手机网站建设口碑好网络搭建是干什么的
  • 网站制作找云优化邮件营销
  • 武汉老牌网站建设公司百度ai人工智能
  • ps上做网站企业网站模板建站
  • 多备份wordpressseo课程培训班
  • 欢迎访问中国建设银行网站seo知识是什么意思
  • adobe可以做网站吗百度搜索引擎的优缺点
  • wordpress转tyseo和sem的区别与联系
  • 哈尔滨营销网站建设各大搜索引擎网址
  • 厦门做网站推广深圳设计公司
  • 网站推广网指数是什么
  • 用vs2017做网站全网整合营销平台
  • 网站建设的一般流程是什么意思夫唯seo教程
  • 给个网站带颜色aso优化前景
  • 做网站开发的薪酬怎么样什么叫做关键词
  • 公司网站怎么备案小红书sem是什么意思
  • 政府网站建设原则北京百度seo点击器
  • 网站规划设计方案搜索引擎优化人员优化
  • java网站开发实战91关键词
  • 网站建设违约免费域名注册查询
  • 以net结尾的网站南京seo推广公司
  • phpweb网站建设做网站seo推广公司
  • 河北建设委员会网站首页网络安全培训机构哪家好
  • 做网站需要哪些工程师网站seo运营培训机构
  • 网页qq手机版网站seo站群软件
  • 网站关键字如何设置谷歌google官网下载