学海无涯

导航

随笔分类 -  WPF

上一页 1 2

IDialogAware 对话框
摘要:<Grid Background="White"> <Grid.RowDefinitions> <RowDefinition Height="Auto"></RowDefinition> <RowDefinition></RowDefinition> <RowDefinition Height="A 阅读全文

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

导航 IRegionManager
摘要:<Window x:Class="PrismWpfBlankApp.Views.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsof 阅读全文

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

MVVM框架 数据绑定 事件命令 发布订阅消息
摘要:<StackPanel> <Button Command="{Binding OpenCommand}" Content="事件" /> <Button Command="{Binding PublishCommand}" Content="发布消息"/> <Button Command="{Bin 阅读全文

posted @ 2022-12-31 16:32 宁静致远. 阅读(98) 评论(0) 推荐(0)

Region 区域
摘要:Region 的作用:在指定区域展示用户控件,是模块化的核心功能,其主要目的是弱化模块与模块之间的耦合关系。 一、定义XML区域: 1.1 使用XML设置区域名称 <ContentControl prism:RegionManager.RegionName="ContentRegion" /> 1. 阅读全文

posted @ 2022-12-31 14:40 宁静致远. 阅读(154) 评论(0) 推荐(0)

TextBox.InputBindings 绑定按键事件
摘要:<TextBox Text="{Binding Search, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" Width="250" md:HintAssist.Hint="查找待办事项" 阅读全文

posted @ 2022-12-29 14:00 宁静致远. 阅读(168) 评论(0) 推荐(0)

微软行为类
摘要:引用命名空间: xmlns:i="http://schemas.microsoft.com/xaml/behaviors" 通过行为类,可以为控件添加触发器 <ScrollViewer Grid.Row="1"> <ItemsControl ItemsSource="{Binding ToDoDto 阅读全文

posted @ 2022-12-29 09:51 宁静致远. 阅读(58) 评论(0) 推荐(0)

MaterialDesignThemes
摘要:1. 用 nuget 添加引用:MaterialDesignThemes 2. 编辑 App.xaml <Application . . . xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"> <Appl 阅读全文

posted @ 2022-12-26 16:44 宁静致远. 阅读(933) 评论(0) 推荐(0)

选择图片并加载显示
摘要:private void shopPicButton_Click(object sender, RoutedEventArgs e) {//选择图片并加载显示 OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.F 阅读全文

posted @ 2022-12-25 15:11 宁静致远. 阅读(25) 评论(0) 推荐(0)

WPF介绍
摘要:主题外观包:MaterialDesignThemes MVVM 模式:Prism.DryIoc 阅读全文

posted @ 2022-12-19 09:22 宁静致远. 阅读(79) 评论(0) 推荐(0)

动画 Animation
摘要:using System.Windows.Media.Animation; <Grid> <StackPanel> <Button x:Name="btn" Content="执行动画" Width="100" Height="40" Click="Button_Click"/> </StackPa 阅读全文

posted @ 2022-12-14 10:42 宁静致远. 阅读(229) 评论(0) 推荐(0)

资源字典 ResourceDictionary
摘要:1.在项目上点右键,添加 ”资源字典WPF“ ,命名为:ButtonStyle.xaml <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://sch 阅读全文

posted @ 2022-12-14 10:39 宁静致远. 阅读(77) 评论(0) 推荐(0)

CommunityToolkit.Mvvm
摘要:public class ViewModel : ObservableObject { public ViewModel() { ShowCommand = new RelayCommand<string>(Show); } private string name; public string Na 阅读全文

posted @ 2022-12-14 09:09 宁静致远. 阅读(283) 评论(0) 推荐(0)

数据模板 DataTemplate
摘要:<Grid> <ListBox x:Name="list"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <Border Width="10" Height="10" Background=" 阅读全文

posted @ 2022-12-13 10:44 宁静致远. 阅读(38) 评论(0) 推荐(0)

Style 控件样式
摘要:<Window.Resources> <Style x:Key="BaseButtonStyle" TargetType="Button"> <Setter Property="FontSize" Value="15"/> </Style> <Style x:Key="myStyle" Target 阅读全文

posted @ 2022-12-12 17:05 宁静致远. 阅读(39) 评论(0) 推荐(0)

DataGrid CRUD(MVVM模式)
摘要:引用程序包:MvvmLight 实体类: public class Student : ViewModelBase { private int id; private string name; public int Id { get { return id; } set { id = value; 阅读全文

posted @ 2022-12-12 14:36 宁静致远. 阅读(62) 评论(0) 推荐(0)

数据绑定
摘要:元素绑定 <StackPanel> <Slider x:Name="slider1" Width="200" ></Slider> <TextBox Name="txt" Text="{Binding ElementName=slider1,Path=Value,UpdateSourceTrigge 阅读全文

posted @ 2022-12-12 09:05 宁静致远. 阅读(44) 评论(0) 推荐(0)

上一页 1 2