WPF Learning Series games-select a picture to make a 9-cell puzzle and a wpf palace Tile
I want to learn about a puzzle project today.
The goal is to input an image, divide it into nine parts, remove one, and click the mouse to complete the puzzle.
The source file structure is simple.
Step 1: Create a project
There is nothing to say in this step. Creating a new project is the same as the source file struct
WPF bubble style pop-up window effect code sharing, wpf bubble style pop-up window
The page design requirement is as follows:
The design concept is as follows:
1. Use Path to draw the tip of the bubble and place it to the top layer;
2. Draw a rectangular box with border, place the box to the bottom layer, and set the Margin value so that the Path layer and border seem to be connected together.
The Code is
In WPF, the interface information is updated. In wpf, the interface information is updated.
1. Dispatcher. BeginInvoke
int ii = 0; new Thread(new ParameterizedThreadStart((i) => { while (true) { Thread.Sleep(400); Dispatcher.BeginInvoke(new Action(() => { ii += 1;
WPF learning path (5) Example: wordboard (continued), wpf Road
WordPad 2.0
In the previous issue, a Wordpad program with comprehensive functions was implemented, but the program code was slightly cumbersome. The Community version was updated in this issue.
MainWindows. xaml
Add the
Menu
Tool
TextBox
MainWindow. xmal. cs
public partial class MainWindow : Window{ private bool isDirty = false; pu
WPF learning path (14) style and template, wpf path style Template
Style
Instance:
If you do not set a style, you need to add duplicate code to each control, which is cumbersome.
You can set the TargetType of the Style. If you do not set x: Key, it will be applied to the conforming control by default. Note that Scope will take effect in the defined Scope.
Style has an Inheritance Mechanism
If you wan
WPF learning path (11) Layout (continued); wpf path
The layout is actually a Slot model. Each parent object is assigned a Slot to the sub-object. The sub-object can freely occupy space in the Slot and is controlled by Margin \ verticalignment \ HorizontalAlignment.
Instance
Note the differences between LayoutTransform and RenderTransform.
Custom Layout
Determining the optimal space size goes through
WPF custom message box, wpf custom message
Note:Create a simple message box that allows you to display images and buttons according to your needs.
Steps:
1. In fact, the message box is a Window. First, set the display position and display size of the form to make it look like there is a message box. The Code is as follows:
Height="206" Width="420" WindowStartupLocation="CenterScreen" BorderThickness="1,0,1,
The message box with masks is displayed in WPF, And the masks are displayed in wpf.
Ideas
Get the content of the parent form, put it in a container, and then put a translucent layer in the container. Assign the entire container to the content of the parent form.
Reverse operation when disabled.
Code
When the message window pops up
1 ///
When the message box is closed
1 ///
Source code download: Message
Submission and revocation of WPF data editing, and revocation of wpf editing
When you add or edit an item to a set (usually bound to a DataGrid or other ItemsControl controls), an attribute of the edit item is usually displayed on the editing page. After editing, the item is submitted, or we don't want to edit the data. At this time, we select cancel. The content of the data item has not changed.
When you
WPF multi-source binding and WPF source binding
The control is bound to multiple data sources, and ListBox is bound to a collection. each item is bound to two attributes of the object in the collection, and the binding is formatted.
Custom value conversion for multi-source binding. The TextBlock control is bound to one of the NameListData sets. When an object in the set is selected, the two attributes of
WPF scroll subtitles and WPF scroll subtitles
XAML code:Background code:Using SunCreate. combatPlatform. domain; using System. collections. generic; using System. linq; using System. text; using System. threading; using System. timers; using System. windows; using System. windows. controls; using System. windows. data; using System. windows. documents; using System. windows. input; using System. windows. me
Simple implementation of WPF bubble prompt box and wpf bubble implementation
I dug a big hole myself, and then I was forced to rewrite the code style! Not much waste
Directly Add code
1
Create a TextBox at the front end, and add the following attributes to the additional attributes:
1
:
Style code:
1
Original Source: http://www.cnblogs.com/PettyHandSome/
You are welcome to repost the article, but w
[WPF series] advanced debugging and wpf series debugging'Provide value on 'System. Windows. baml2006.typeconvertermarkupextension' threw an exception. 'line number '49' and Line position '38' in ImageBrush'
Assuming the image is:
Added in your project
It's in a folder named "Images"
The build action for the image is set to "Resource" (shocould be the default)
You can reference it like this:
Chuanzhi podcast -- WPF basic video learning -- sender explanation, -- wpf -- sender
Sender is the object that fires the event. If it is used in the double-click event of the Button, it is only the currently clicked object.
For example, there are two Button controls: 1 and 2, respectively, and a Button_Click event is bound.
Private void Button_Click (object sender, RoutedEventArgs e) {Button btn = (Button)
Debug the dependency attribute of WPF by Windbg, and debug wpf by windbgWhen we use wndbg for debugging, we often need to view the dependency attribute values of a control.For example, we can view the Content dependency attribute of the DataGridColumnHeader.1. The windbg commands we use include :! Do ,! Da-details,. formats2. Use it! Do: view the member variables of the dependent object and find the specifi
While building a beautiful UI, we also need to focus on the performance of the application, especially for WPF. The following describes some useful performance optimizations In the MS documentation. For more information, see. This Post is not completely original and is summarized based on some documents.
1. When creating a logical tree, try to consider building the logic from the parent node to the child node. Because when a node of the logic tree cha
[WPF problems] how to disable the system menu of the WPF window (systemmenu)
Zhou yinhui
When you click the icon in the upper-left corner of the window, the displayed menu is the system menu. Sometimes you need to disable or remove some or all of the menu items. Some netizens also asked this question just now. OK, paste the Code:
To disable (remove) All menu items, call systemmenumanager. removewindowsystem
The WPF control content model refers primarily to the various controls that derive from the System.Windows.Controls.Control class, which are divided into four parts:
ContentControl
Headeredcontendcontrol
itemscontrol
HeaderedItemsControl
Its inheritance relationship please refer to my previous blog's content.
These four classes are used as base classes for most controls in WPF. Classes that use these
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.