richtextbox 字体颜色 wpf笔记(读一线码农8天入门wpf)(2)

电脑杂谈  发布时间:2018-02-18 16:03:52  来源:网络整理

3:TwoWay Source与Target相互影响。richtextbox 字体颜色

4:OneTime 在OneWay的基础上延伸了一个OneTime,仅绑定一次。

●.net对象与控件的绑定

List<Student> list = new List<Student>();

richtextbox在哪里_richtextbox显示图片_richtextbox 字体颜色

list.Add(new Student() { Name = "hxc", Age = 20 });

listView1.ItemsSource = list;

<GridViewColumn Header="姓名" DisplayMemberBinding="{Binding Name}"/>

注意IValueConverter的使用,可以控制特定行颜色等,具体使用搜索IValueConverter

●.net方法与控件的绑定

public class Student

{

//前台要引用的方法

public string GetName()

{

return "一线码农";

}

}

<ObjectDataProvider x:Key="Test" ObjectType="{x:Type local:Student}" MethodName="GetName"></ObjectDataProvider>

<TextBlock Text="{Binding Source={StaticResource ResourceKey=Test}, Mode=OneWay}"/>

●验证数据

实现ValidationRule接口,然后写上自定义的验证逻辑

****************细说控件****************

●内容控件 全部基于ContentControl、

一、ButtonBase:1.Button,2.RepeatButton(重复执行click事件),3.GridViewColumnHeader,4.ToggleButton(radio,check)

二、HeaderedContentControl:1.Expander,2.GroupBox,3.TabItem

三、ToolTip 不能独立的作为一个控件使用,而是与其他具体控件的ToolTip联合使用。ToolTipSerivce类,可用于设计Tooltip显示的相对位置,提示时间

四、ScrollViewer

●条目控件 继承自ItemsControl 两个重要属性Items(ItemCollection类型)和ItemsSource(IEnumerable类型)

一、MenuBase:1.Menu,2.ContextMenu

二、Selector:1.Listbox,2.ComboBox,3.TabControl,4.ListView

三、StatusBar

四、TreeView

●文本控件 TextBox,RichTextBox,PasswordBox

●范围控件 基于RangeBase,重要属性LargeChange,SmallChange,Maximum,Minimum

一、ScrollBar

联动<ScrollBar Orientation="Horizontal" Maximum="100" Minimum="5" SmallChange="2" />

<TextBox Text="{Binding ElementName=test, Path=Value}"/>


本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/jisuanjixue/article-83770-2.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...