WPF implements signature photo function

?About the author: 2022Blog Rising StarEighth. A Java back-end developer who loves Chinese studies, he cultivates his mind and improves his technology simultaneously. Personal homepage: Java Fans’ blog Personal creed: Don’t express your anger and never make mistakes. Little knowledge, great wisdom. Current column: WPF case and knowledge sharing column ?Featured column: Fun Chinese Studies-The […]

WPF implements verification of TextBox input content

1.ValidatesOnExceptions verification <Window x:Class=”WpfApplication.MainWindow” xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” xmlns:d=”http://schemas.microsoft.com/expression/blend/2008″ xmlns:local=”clr-namespace:WpfApplication” xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006″ xmlns:system=”clr-namespace:System;assembly=mscorlib” Title=”MainWindow” Width=”400″ Height=”500″ mc:Ignorable=”d”> <Window.Resources> <Style TargetType=”TextBox”> <Style.Triggers> <Trigger Property=”Validation.HasError” Value=”True”> <Setter Property=”ToolTip” Value=”{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}” /> </Trigger> </Style.Triggers> </Style> </Window.Resources> <Window.DataContext> <local:MainWindowViewModel /> </Window.DataContext> <StackPanel> <TextBox Margin=”0,10,0,5″ Text=”{Binding UserName, ValidatesOnExceptions=True}” /> <TextBox Margin=”0,5,0,5″ Text=”{Binding Age}” /> <Button Content=”Reguster” /> </StackPanel> </Window> using GalaSoft.MvvmLight; […]

WPF grayscale application

Greyscale application in WPF Control name: GrayscaleEffect Author: WPFDevelopersOrg – Jinghua Original link [1]: https://github.com/WPFDevelopersOrg/WPFDevelopersSimple source code [2]: https://github.com/yanjinhuagood/WPFApplicationGrayscale Frameworks use .NET4 to .NET6; Visual Studio 2019; If you want to achieve the first grayscale effect, you need to change the theme color, but using the theme color requires recoloring which is slow. You need […]

Customize the window drag and zoom after setting the NoResize property of the WPF window

Add the following controls in xmal to mark the left, right, upper, and lower edges and the upper left, upper right, lower left, and lower right corners respectively. When the mouse moves in, out, or clicked, it triggers setting the mouse icon and resetting the icon respectively. , trigger resize and other operations <Path x:Name=”ResizeNW” […]

A preliminary study on WPF Binding

A preliminary study on WPF Binding Binding basics Binding translates as binding. In WPF, Binding can be understood as a bridge connecting the data source (Source) and the target (Target). Generally speaking, the data source of Binding is the object of the logic layer, and the Binding target is the control object of the UI […]

Customization of WPF window Title

Table of Contents 1. WindowChrome 1.ResizeBorderThickness 2.CaptionHeight 3. CornerRadius 4. GlassFrameThickness 5. NonClientFrameEdges 6. UseAeroCaptionButtons 7. IsHitTestVisibleInChrome 2. Adorner, Decorator and AdornerDecorator 3. Freely change the display of Title and retain the zoom in, zoom out and close buttons. 4. Freely change the display of Title, hide the zoom in, zoom out and close buttons, […]

WPF ListView mouse click, move and change background color does not work

Build data source <Window.Resources> <x:ArrayExtension x:Key=”stringList” xmlns=”clr-namespace:System;assembly=mscorlib” Type=”String”> <String>First line</String> <String>Second line</String> <String>Third line</String> <String>The fourth line</String> </x:ArrayExtension> </Window.Resources> 1. + can take effect and the background color will change. Store triggers in ListView.ItemContainerStyle Store data in ListView.View In this way, multiple columns and multiple rows can only be displayed in columns, but multiple rows […]

WPF user control relies on property assignment

Article directory Preface How to develop components Main window reference control window Dependency injection code optimization Updated December 9, 2023 Simplified dependency injection end Foreword I have always wanted to develop WPF with components, because I think it is best to simplify complex problems. How to develop components Main window reference <Window x:Class=”WpfApp1.MainWindow” xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” […]

Implement navigation function in MVVM mode in WPF

Implementing navigation function in MVVM mode in WPF 1. Using TabControl Usage scenario: The project is small, so there is no need to consider memory overhead. Implementation method 1-manually specify ViewModel Define 3 UserControl as Views for demonstration <UserControl …> <Grid> <StackPanel Orientation=”Vertical”> <TextBlock HorizontalAlignment=”Center” VerticalAlignment=”Top” Text=”Page 1″ /> <TextBlock d:Text=”Page 1″ FontSize=”50″ Text=”{Binding PageMessage}” […]

Listview content is displayed in the center in wpf

When using ListView in WPF, GridView is often used as the view, but the GridViewColumn cannot be centered and aligned. Implementation Set Style to ListViewItem and let ListViewItem stretch and fill in the horizontal direction: Then just set the center alignment for the Datatemplate of GridViewColumn. Example code <ListView x:Name=”_detectionListView” ItemsSource=”{Binding DetectionCheckList}” Background=”White” BorderThickness=”0″ ScrollViewer.HorizontalScrollBarVisibility=”Disabled”> […]