学海无涯

导航

随笔分类 -  WPF

1 2 下一页

Graphics 图形
摘要:您可以将图形元素与标记中的其他元素无缝混合。布局对图形的作用与对任何其他元素的作用完全相同。 图形和其他内容不仅可以在标记中并排存在,而且它们甚至可以混合在一起。 <TextBlock FontSize="24" TextWrapping="Wrap"> And of course you can 阅读全文

posted @ 2023-01-22 17:11 宁静致远. 阅读(64) 评论(0) 推荐(0)

Resources 资源
摘要:资源具有非常广泛的含义,在WPF中任何对象都可以是资源。 一个对象不必做任何特殊的事情就可以成为资源。资源处理基础架构完全致力于让您能够获取所需的资源,而不管资源是什么。它只是提供了一种识别和定位对象的机制。 资源管理的核心是ResourceDictionary类 程中添加资源: ResourceD 阅读全文

posted @ 2023-01-20 14:42 宁静致远. 阅读(158) 评论(0) 推荐(0)

Windows and Dialogs 窗体 对话框
摘要:<Window x:Class="WpfTestBlankApp.Views.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft 阅读全文

posted @ 2023-01-20 11:50 宁静致远. 阅读(47) 评论(0) 推荐(0)

Windows and Dialogs 窗口和对话框
摘要:无边框,无外壳,且不能改变大小的窗口: WindowStyle="None" ResizeMode="NoResize" 窗口生命周期: Activated 当窗口被激活(例如,单击)时引发。如果窗口从未被激活,您将不会获得此事件(或相应的 Deactivated事件)。 Closing 当窗口试图 阅读全文

posted @ 2023-01-15 11:05 宁静致远. 阅读(184) 评论(0) 推荐(0)

Control Templates 控制模板
摘要:简单控制模板 <Button Margin="0,0,2,2" Grid.Row="0" Grid.Column="0" Name="cell00" > <Button.Template> <ControlTemplate> <Grid> <Rectangle Fill="Orange"/> </G 阅读全文

posted @ 2023-01-13 18:21 宁静致远. 阅读(63) 评论(0) 推荐(0)

Styles 样式
摘要:Inline Styles 内联样式 <Button Margin="0,0,2,2" Grid.Row="0" Grid.Column="0" Name="cell00" > <Button.Style> <Style> <Setter Property="Button.FontSize" Val 阅读全文

posted @ 2023-01-12 16:25 宁静致远. 阅读(69) 评论(0) 推荐(0)

Binding to List Data 绑定到列表数据
摘要:得到当前项 1 void birthdayButton_Click(object sender, RoutedEventArgs e) { 2 // Get the current person out of the collection view 3 People people = (People 阅读全文

posted @ 2023-01-11 10:57 宁静致远. 阅读(138) 评论(0) 推荐(0)

Data Binding 数据绑定
摘要:Person person = new Person("Tom", 11); public MainWindow(IRegionManager regionManager) { InitializeComponent(); birthdayButton.Click += BirthdayButton 阅读全文

posted @ 2023-01-10 09:48 宁静致远. 阅读(54) 评论(0) 推荐(0)

控件
摘要:什么是控件? 大多数流行的 UI 框架都提供类似于控件的抽象,而 WPF 采用了一种稍微不寻常的方 法,因为控件通常不直接负责它们自己的外观。 WPF 中的控件都是关于行为的,它们 遵从模板来提供视觉效果。许多 GUI 框架要求您在自定义控件外观时编写自定义控 许多 WPF 用户界面元素不是控件。例 阅读全文

posted @ 2023-01-09 09:06 宁静致远. 阅读(169) 评论(0) 推荐(0)

事件
摘要:事件分为:冒泡事件、隧道事件、和直接事件 隧道事件名称始终以Preview开头并首先引发。这使目标元素的父元素有机会在事件到达子元 素之前看到它(因此有Preview前缀)。隧道预览事件紧随冒泡事件之后。 在大多数情况下,只处理冒泡事件,隧道事件通常仅在你希望能够阻止该事件时,或者如果你需要父级在正 阅读全文

posted @ 2023-01-08 11:57 宁静致远. 阅读(104) 评论(0) 推荐(0)

共享尺寸组 SharedSizeGroup
摘要:整体布局由DockPanel 定义,使用附加的Dock.Top属性将标头Grid定位在顶部,并 允许ScrollViewer填充剩余空间。 1 <DockPanel Grid.IsSharedSizeScope="True"> 2 <DockPanel.Resources> 3 <Style Tar 阅读全文

posted @ 2023-01-07 13:20 宁静致远. 阅读(173) 评论(0) 推荐(0)

绘图
摘要:画线 <Rectangle Grid.Row="5" Grid.ColumnSpan="2" Height="1" Fill="Blue" /> <Border Grid.ColumnSpan="2" Grid.Row="4" VerticalAlignment="Top" BorderBrush= 阅读全文

posted @ 2023-01-07 12:30 宁静致远. 阅读(50) 评论(0) 推荐(0)

实现单应用程序,即只能启动一个实例
摘要:1 using Prism.Ioc; 2 using System.Threading; 3 using System.Windows; 4 using WpfTestBlankApp.Views; 5 6 namespace WpfTestBlankApp 7 { 8 /// <summary> 阅读全文

posted @ 2023-01-05 17:09 宁静致远. 阅读(46) 评论(0) 推荐(0)

ListBox
摘要:1 <ListBox ItemsSource="{Binding}" IsSynchronizedWithCurrentItem="True"> 2 <ListBox.ItemTemplate> 3 <DataTemplate> 4 <TextBlock> 5 <TextBlock Text="{B 阅读全文

posted @ 2023-01-05 09:05 宁静致远. 阅读(68) 评论(0) 推荐(0)

Wpf原生MvvM
摘要:using System.ComponentModel; namespace WpfTestBlankApp.Models { public class Nickname : INotifyPropertyChanged { public event PropertyChangedEventHand 阅读全文

posted @ 2023-01-05 09:03 宁静致远. 阅读(66) 评论(0) 推荐(0)

Layout 布局
摘要:WPF 附带以下通用面板布局控件: Grid(网格) 按开发人员指定的行和列排列内容,不用固定大小和位置。最强大的内置布局控件 1 <Grid> 2 <Grid.RowDefinitions> 3 <RowDefinition /> 4 <RowDefinition /> 5 <RowDefinit 阅读全文

posted @ 2023-01-04 17:35 宁静致远. 阅读(126) 评论(0) 推荐(0)

特殊字符和空白
摘要:XMAL 字符实体 特殊字符 字符实体 < &lt; > &gt; & &amp; " &quot; <Button> &lt;Click Me&gt; </Button> 保留字符串的首尾空格 <TextBox xml:space="preserve" Foreground="White"> Th 阅读全文

posted @ 2023-01-03 16:13 宁静致远. 阅读(85) 评论(0) 推荐(0)

FontAwesome 字体图标 IconFont
摘要:一、Nuget 上安装 FontAwesome 阅读全文

posted @ 2023-01-02 12:56 宁静致远. 阅读(17) 评论(0) 推荐(0)

MaterialDesign 控件
摘要:为按钮添加阴影 <Button Width="250" materialDesign:ElevationAssist.Elevation="Dp5" Style="{StaticResource MaterialDesignRaisedButton}" ToolTip="MaterialDesign 阅读全文

posted @ 2023-01-02 12:02 宁静致远. 阅读(126) 评论(0) 推荐(0)

WPF常用控件
摘要:<ImageBrush ImageSource="/background.png" Stretch="UniformToFill" Opacity="0.3"/> background.png 属性->生成操作->资源 填充渐变颜色 <Grid> <Grid.Background> <LinearG 阅读全文

posted @ 2023-01-02 11:02 宁静致远. 阅读(49) 评论(0) 推荐(0)

1 2 下一页