WPF学习日记55

1.System.Windows.Data.Binding.Binding(string path)
解析:使用初始路径初始化Binding类的新实例。

2.RoutedEventHandler System.Windows.FrameworkElement.Loaded
解析:当对元素进行布局、呈现,且可将其用于交互时发生。

3.System.Windows.Controls.Primitives.Selector.SelectedItem
解析:获取或设置当前所选内容中的第一项或如果所选内容为空则返回null。

4.SolidColorBrush System.Windows.Media.Brushes.AliceBlue
解析:获取具有十六进制值#FFF0F8FF的纯色填充颜色。

5.System.Windows.Controls.Expander.ExpandDirection
解析:获取或设置在其中的方向Expander内容窗口随即打开。

6.System.Windows.GridUnitType
解析:描述GridLength对象包含的值的种类。

7.System.Windows.Controls.ItemsControl.ItemsSource
解析:获取或设置用于生成ItemsControl的内容的集合。

8.System.Windows.Input.MouseButtonEventArgs
解析:为鼠标按钮相关事件提供数据。

9.System.ICloneable
解析:支持克隆,即用与现有实例相同的值创建类的新实例。

10.int Dapper.SqlMapper.Execute(this IDbConnection cnn, string sql, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
解析:Execute parameterized SQL.

11.System.Windows.Media.LinearGradientBrush
解析:使用线性渐变绘制区域。

12.System.Windows.Controls.TextBlock.Foreground
解析:获取或设置要应用到TextBlock的文本内容的Brush。

13.控件模板和数据模板
解析:控件模板主要是用来改变控件的外观,数据模板则定义控件中数据的表现方式。

14.控件模板ControlTemplate
解析:
[1]VistualTree视觉树,即是能看到的外观
[2]Trigger触发器,里面包括外部条件达到某一条件下会引起的响应

15.定义按钮控件模板
解析:

<Window.Resources >
    <ControlTemplate x:Key="buttonTemplate" TargetType="Button" >
        <Grid >
            <Ellipse Name="faceEllipse" Height="50" Width="100" Fill="{TemplateBinding Button.Background}"/>
            <TextBlock Name="txtBlock"  />
        </Grid >
        <ControlTemplate.Triggers >
            <Trigger Property="Button.IsMouseOver" Value="True">
                <Setter Property="Button.Background" Value="blue"/>
            </Trigger >
        </ControlTemplate.Triggers >
    </ControlTemplate >
</Window.Resources >

使用按钮控件模板代码:

<Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="216,224,0,0" Name="button3"  Width="75" Template="{StaticResource buttonTemplate}"/>

16.DataTemplate模板
解析:通过数据模板在一个listbox控件中为了显示多行和多列数据:

<ListBox Height="202" HorizontalAlignment="Left" Margin="21,12,0,0" Name="listBox1" VerticalAlignment="Top" Width="384" >
    <ListBox.ItemTemplate >
        <DataTemplate >
            <StackPanel Orientation="Horizontal" >
                <TextBox Width="60" Text="{Binding Path=Name}"/>
                <TextBox Width="60" Text="{Binding Path=ID}"/>
                <TextBox Width="60" Text="{Binding Path=Age}"/>
            </StackPanel >
        </DataTemplate >
    </ListBox.ItemTemplate >
</ListBox >

17.WPF中的style
解析:

<Window.Resources >
    <ResourceDictionary >
        <Style x:Key="dgButton" TargetType="Button" >
            <Setter Property="Background" Value="Blue" />
            <Setter Property="FontSize" Value="20"/>
        </Style >
        <Style x:Key="cb" TargetType="CheckBox" >
            <Style.Triggers >
                <Trigger Property="IsChecked" Value="True">
                    <Setter Property="FontSize" Value=" 40"/>
                    <Setter Property="Foreground" Value="Red" />
                </Trigger >
            </Style.Triggers >
        </Style >
    </ResourceDictionary >
</Window.Resources >

调用方式为:

<Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="216,224,0,0" Name="button3" VerticalAlignment="Top" Width="75" Style ="{StaticResource dgbutton}"/>
<CheckBox Content="CheckBox" Height="58" HorizontalAlignment="Left" Margin="654,16,0,0" Name="checkBox1" VerticalAlignment="Top" Width="175" Style="{StaticResource cb}" Grid.Row="1" />

18.WPFtrigger主要类型
解析:
[1]Trigger、MultiTrigger、DataTrigger、MultiDataTrigger、EventTrigger
[2]trigger主要运用的场景在Style、ControlTemplate、DataTemplate三个地方

19.静态常量和动态常量
解析:
[1]静态常量[const]是指编译器在编译时候会对常量进行解析,并将常量的值替换成初始化的那个值。
[2]动态常量[readonly]的值则是在运行的那一刻才获得的,编译器编译期间将其标示为只读常量,而不用常量的值代替,这样动态常量不必在声明的时候就初始化,而可以延迟到构造函数中初始化。

20.System.Windows.Data.Binding.ElementName
解析:获取或设置要用作绑定源对象的元素的名称。

21.System.Windows.FrameworkElement.DataContext
解析:获取或设置元素参与数据绑定时的数据上下文。

22.System.Windows.Controls.UserControl
解析:提供创建的控件的简单方法。

23.System.Windows.FrameworkElement.DataContext
解析:获取或设置元素参与数据绑定时的数据上下文。

24.bool System.Windows.UIElement.Focus()
解析:尝试将焦点设定到此元素上。

25.将UserControl添加到Window窗体方法
解析:
[1]在XMAL中添加
[2]在CS代码中添加

参考文献:
[1]WPF中触发器Trigger、MultiTrigger、DataTrigger、MultiDataTrigger:https://mp.weixin.qq.com/s/uLq_2ZRPTAmv_D4icvtV7g
[2]WPF的UserControl用户控件怎么添加到Window窗体中:https://www.cnblogs.com/lelehellow/p/6026766.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

NLP工程化

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值