网络资源-深入剖析Binding2(学习)

WPF Binding 

WPF里分三种Binding:Binding, PriorityBinding, MultiBinding,这三种Binding的基类都是BindingBase,而BindingBase又继承于MarkupExtension

Binding:

提供对绑定定义的高级别访问,绑定将绑定目标对象(通常为 WPF 元素)的属性与任何数据源(例如数据库、XML 文件或包含数据的任何对象)连接起来。

常见的使用Binding的代码:

C#

Binding binding = new Binding();     
binding.Source = treeView; // Set source object
binding.Path = new PropertyPath("SelectedItem.Header"); // Set source property
SetBinding(TextBlock.TextProperty, binding);  // Attach to target property currentFolder.

所有 FrameworkElement都包含SetBinding方法:SetBinding(DependencyProperty dp, String path), SetBinding(DependencyProperty dp, BindingBase binding),可以看出,FrameworkElement中的SetBinding只对DependencyProperty有效

另一种设置Binding的方法是:BindingOperations.SetBinding(currentFolder, TextBlock.TextProperty, binding);
BindingOperations.SetBinding的原型是

public static BindingExpressionBase SetBinding( DependencyObject target, DependencyProperty dp, BindingBase binding)

第一个参数是DependencyObject,所以我们可以对自定义DependencyObject或者继承自DependencyObject的类进行绑定。当然第二个参数还是DependencyProperty。

  XAML:

<TextBlock x:Name=”currentFolder” 
          DockPanel.Dock=”Top”
          Text=”{Binding ElementName=treeView, Path=SelectedItem.Header}”
          Background=”AliceBlue”
          FontSize=”16”/>


清除Binding:

BindingOperations.ClearBinding(currentFolder, TextBlock.TextProperty); //删除currentFolder上的TextBlock.TextProperty绑定
BindingOperations.ClearAllBindings(currentFolder); //删除currentFolder上的所有绑定 

直接对dependency property赋值也可以解除binding, 不过只对单向binding有效。  


Bingding的源:

有三个属性用来设置源:ElementName(string)、Source(Object) 和 RelativeSource(RelativeSource)。注:这三个只能指定一个,否则异常
1:ElementName: Xaml最基础的binding,源为一个元素(Element),这里指的设置x:Name属性的那个元素
2:Source:以object作为源。
<TextBlock Text="{Binding Source={StaticResource myDataSource}, Path=PersonName}"/>
3:RelativeSource: 源相对于绑定目标的位置(比如要绑定到之前的几个parent元素)。
  •   源是元素本身的例子:{Binding RelativeSource={RelativeSource Self}}
  •   源是Tempalte中元素的Parent:{Binding RelativeSource={RelativeSource TemplatedParent}}
  •   源是绑定以collection形式的前一个数据:{Binding RelativeSource={RelativeSource PreviousData}},MSDN上关于PreviousData的说明并不多,这里有一篇文章可以参考
以上三项为RelativeSource中的Static值,使用这些值可以减少内存开销
  •   源是Ancestor(可能比parent还高):{Binding RelativeSource={RelativeSource FindAncestor, AncestorLevel=n, AncestorType={x:Type desiredType}}}
    <Window x:Class="Yingbao.Chapter2.RelativeEx.AppWin"   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"   Title="相对绑定" Height="100" Width="300">    <StackPanel Orientation="Horizontal"    HorizontalAlignment="Center">   <TextBlock FontSize="20" Text="{Binding  RelativeSource={RelativeSource self}, Path=FontSize}"/>           <TextBlock Margin="10,1,1,5"  FontSize="20" Text="{Binding  RelativeSource={RelativeSource AncestorType={x:Type StackPanel}}, Path=Orientation}"/>                           </StackPanel>   </Window>  

在这个例子中,使用了两个相对数据源扩展,第一个TextBlock的Text绑定到自身的字体大小上;第二个TextBlock的Text则绑定到其父节点StackPanel的Orientation属性上。这段XAML的运行结果如图2-5所示。



Path:

1:Binding中的Path是PropertyPath对象。在最简单的情况下,Path制定一个源的属性,如 Path=PropertyName

2:通过类似于 C# 中使用的语法,可以指定子属性。例如,子句 Path=ShoppingCart.Order 将绑定设置为对象的子属性 Order。

   3:若要绑定到附加属性,请将附加属性用括号括起。例如,若要绑定到附加属性 DockPanel.Dock,则语法为 Path=(DockPanel.Dock)。

4:在应用了索引器的属性名称之后的方括号内,可以指定属性的索引器。例如,子句 Path=ShoppingCart[0] 将绑定设置为与属性的内部索引处理文本字符串“0”的方式对应的索引。此外,还支持多个索引器。在 Path 子句中可以同时使用索引器和子属性,例如,Path=ShoppingCart.ShippingInfo[MailingAddress,Street]。在索引器内部,可以有多个由逗号 (,) 分隔的索引器参数。可以使用圆括号指定每个参数的类型。例如,可以使用 Path="[(sys:Int32)42,(sys:Int32)24]",其中 sys 映射到 System 命名空间。

   5:如果源为集合视图,则可以用斜杠 (/) 指定当前项。例如,子句 Path=/ 设置到视图中当前项的绑定。如果源为集合,则此语法指定默认集合视图的当前项。

6:可以结合使用属性名和斜杠来遍历作为集合的属性。例如,Path=/Offices/ManagerName 指定源集合的当前项,该源集合包含同样是集合的 Offices 属性。其当前项是包含 ManagerName 属性的对象。

7:也可以使用句点 (.)路径绑定到当前源。例如,Text=”{Binding}” 等效于 Text=”{Binding Path=.}”。

 


 


BindingExpression

Binding 类是高级别类。BindingExpression 类是基础对象,用于保持绑定源与绑定目标之间的连接。Binding 中包含可在多个 BindingExpression 对象之间共享的所有信息。也就是说,可以把一个Binding对象绑定对n个元素上,而针对这n个元素,分别有相应的n个BindingExpresion对象。
Binding 可以直接绑定普通的.net实例,比如int值。但是如果后台改变int值了,前台不能显示改变后的值,这时可以调用UpdateTarget()方法更 新绑定。如下:

BindingExpression be = button.GetBindingExpression(Button.ContentProperty);
be.UpdateTarget();   

还有UpdateSource方法用来更新源。

 


 

绑定到.net属性/对象:

 上面提到Binding绑到普通的.net属性,如果source变化了,UI上是不会显示的,除了用BindingExpression每次显式更新Target外,还可以使用如下技术:绑定到单个对象需实现INotifyPropertyChanged接口,这个接口只有一个成员:

event PropertyChangedEventHandler PropertyChanged
 
实现INotifyPropertyChanged的示例如下:
using System.ComponentModel;    
namespace SDKSample { // This class implements INotifyPropertyChanged // to support one-way and two-way bindings // (such that the UI element updates when the source // has been changed dynamically) public class Person : INotifyPropertyChanged { private string name; // Declare the event public event PropertyChangedEventHandler PropertyChanged; public Person() { } public Person(string value) { this.name = value; } public string PersonName { get { return name; } set { name = value; // Call OnPropertyChanged whenever the property is updated OnPropertyChanged("PersonName"); } } // Create the OnPropertyChanged method to raise the event protected void OnPropertyChanged(string name) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(name)); } } } } 或者显式实现INotifyPropertyChanged:
#region INotifyPropertyChanged Members  event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged  {      add      {          this.PropertyChanged = (PropertyChangedEventHandler)Delegate.Combine(this.PropertyChanged, value);      }      remove      {          this.PropertyChanged = (PropertyChangedEventHandler)Delegate.Remove(this.PropertyChanged, value);      }  }  #endregion
 
看了上面代码着实没看出source值改变了,前台是通过什么机制反映的,正常的情况下公开了一个事件,必须有一个对此事件的实现体,而上面代码并没有实现PropertyChanged的方法。
我猜想是Binding内部获取了这个接口并对PropertyChanged进行了赋值,因为在debug时,这个事件确实被赋值的,而赋值前的Stack是External Code调用的。
 
绑定到集合需实现INotifyCollectionChanged,但是推荐使用ObservableCollection<T>,这个类实现了INotifyCollectionChanged和INotifyPropertyChanged。
 
附:当绑定到普通的.net属性时,WPF使用反射取得source的值,当对象实现ICustomTypeDescriptor时,WPF使用这个接口取得值,性能上会有所提升。

 


 


DataContext:


DataContext在共享资源时最有用

 <StackPanel x:Name="parent" DataContext="{StaticResource photos}">  
<Label x:Name="numItemsLabel"  Content="{Binding Path=Count}"  DockPanel.Dock="Bottom"/>等价C#中代码是:parent.DataContext = photos;

 


 

Value Converters:  IValueConverter可以在绑定时加入自己的逻辑,很好。

C#中建立converter
public class RawCountToDescriptionConverter : IValueConverter{

  public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { int num = int.Parse(value.ToString()); // Let Parse throw an exception if the input is bad return num + (num == 1 ? " item" : " items"); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotSupportedException(); } }
IValueConverter就两个方法需要自己实现,Convert和ConvertBack,一个转过来,一个转过去。

XAML代码使用converter
<Window.Resources> <local:CountToBackgroundConverter x:Key="myConverter"/> </Window.Resources>
......
<Label Background="{Binding Path=Count, Converter={StaticResource myConverter}, Source={StaticResource photos}}"/>

这里的myConverter是个resource,需要在xaml中预先定义:

Count值会作为第一个参数value传给Convert方法。
注意,返回的值一定要是绑定时对应的值,比如绑定时需要绑到Geometry类上,那么Convert返回的也必须是Geometry类。
 
Convert方法还带有一个parameter参数,可以在xaml中这么使用,这样C#代码中就可以得到parameter的值了。
<Label Background="{Binding Path=Count, Converter={StaticResource myConverter},   ConverterParameter=Yellow, Source={StaticResource photos}}"/>

ConverterParameter是object类型。

TIP:
可以用Binding.DoNothing作返回值,以指示绑定引擎不要执行任何操作。
可 用使用[ValueConversion(typeof(DateTime), typeof(String))]来标识Converter要转化和返回的值类型,第一个参数是soure,第二个参数是target。这样在编译时,如 果类型不匹配的话,编译器会抛出异常:error CS0592: Attribute 'ValueConversion' is not valid on this declaration type. It is only valid on 'class' declarations.

.net自带一些converter,比如常用的BooleanToVisibilityConverter,可以根据checkbox是否勾上来隐藏其他控件。

常见的使用位置:

  • 在collection中使用converter
  • 使用DateTemplate,在其中使用Converter
  • 也可以使用Converter对整个collection进行转化,但是可能效率不好

 


 Binding.Mode

指示源和目标间数据流的方向。

  • OneWay 源更新时,目标也更新
  • TwoWay 源更新时目标也更新,或者目标更新时同时更新源
  • OneTime 仅当应用程序启动时或 DataContext 进行更改时更新目标属性。绑一次就不更维护更新,目标相当于源的一次性镜像
  • OneWayToSource 目标更新时更新源,和OneWay相反。OneWayToSource 用于多个目标更改一个源的情况,可以想像成多人录入。或者用来实现源和目标倒置的情况。

大部分WPF自带的控件的dependency property默认的是OneWay,像TextBox.Text默认的是TwoWay。
值得注意的事,只读属性只能设置成OneWay,不能是TwoWay,否则运行时异常。

注意:再次提醒,源要实现INotifyPropertyChanged 接口才能传到目标。

  • 对于 OneWay 或 TwoWay 绑定,对源的动态更改不会自动传播到目标。必须在源对象上实现 INotifyPropertyChanged 接口。
  • 对于 TwoWay 绑定,对目标的更改不会自动传播到源,除非绑定目标是 Text 属性。在这种情况下,更新仅在 TextBox 失去焦点时发生。
  • 对于 OneTime 和 OneWay 绑定,对 SetValue 的调用会自动更改目标值并删除绑定。

 

Binding实例:   http冒号//www点wpf123点com/news/?8849.html
MainWindow.xaml前台表现:
View Code
 1 <Window x:Class="Binding2.MainWindow"
 2                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 3                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 4                 Title="MainWindow" Height="350" Width="525">
 5 
 6     <Window.Resources>
 7         <DataTemplate x:Key="nameDT">
 8             <TextBlock x:Name="textBoxName" Text="{Binding Name}"/>
 9         </DataTemplate>
10         
11         <DataTemplate x:Key="skillDT">
12             <TextBlock x:Name="textBoxSkill" Text="{Binding Skill}"/>
13         </DataTemplate>
14         
15         <DataTemplate x:Key="hmDT">
16             <CheckBox x:Name="checkBoxJob" IsChecked="{Binding HasM}"/>
17         </DataTemplate>
18         
19     </Window.Resources>
20         <Grid Margin="5">
21         <Grid.RowDefinitions>
22             <RowDefinition Height="3*"/>
23             <RowDefinition Height="1*"/>
24         </Grid.RowDefinitions>
25         <ListView x:Name="listViewHeros" Grid.Row="0">
26             <ListView.View>
27                 <GridView>
28                     <GridViewColumn Header="ID" DisplayMemberBinding="{Binding Id}"/>
29                     <GridViewColumn Header="姓名" CellTemplate="{StaticResource nameDT}"/>
30                     <GridViewColumn Header="能力" CellTemplate="{StaticResource skillDT}"/>
31                     <GridViewColumn Header="已婚" CellTemplate="{StaticResource hmDT}"/>
32                     
33                 </GridView>
34             </ListView.View>
35         </ListView>
36         <Button Grid.Row="1" Content="给关老爷正名!" Click="Button_Click"/>
37     </Grid>
38 </Window>
MainWindow.xaml后台数据:
View Code
  1 using System;
  2 using System.Collections.Generic;
  3 using System.Linq;
  4 using System.Text;
  5 using System.Windows;
  6 using System.Windows.Controls;
  7 using System.Windows.Data;
  8 using System.Windows.Documents;
  9 using System.Windows.Input;
 10 using System.Windows.Media;
 11 using System.Windows.Media.Imaging;
 12 using System.Windows.Navigation;
 13 using System.Windows.Shapes;
 14 using System.ComponentModel;
 15 
 16 namespace Binding2
 17 {
 18     /// <summary>
 19     /// Interaction logic for MainWindow.xaml
 20     /// </summary>
 21     public partial class MainWindow : Window
 22     {
 23 
 24         public class Hero : INotifyPropertyChanged
 25         {
 26             public event PropertyChangedEventHandler PropertyChanged;
 27 
 28             private string skill;
 29             private string name;
 30 
 31             public int Id { get; set; }
 32             public string Name 
 33             {
 34                 get { return name; } 
 35                 set 
 36                 { 
 37                     name = value;
 38                     if (PropertyChanged != null)
 39                     {
 40                         PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Name"));
 41                     }
 42                 }
 43             }
 44             public bool HasM { get; set; }
 45             public string Skill 
 46             {
 47                 get { return skill; }
 48                 set 
 49                 {
 50                     skill = value;
 51                     if (PropertyChanged != null)
 52                     {
 53                         PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Skill"));
 54                     }
 55                 }
 56             }
 57 
 58 
 59             public Hero(int id, string name, string skill, bool hasM) 
 60             {
 61                 this.Id = id;
 62                 this.Name = name;
 63                 this.Skill = skill;
 64                 this.HasM = hasM;
 65             }
 66         }
 67 
 68         Dictionary<string, Hero> map = new Dictionary<string, Hero>();
 69 
 70         private void InitDictionary() 
 71         {
 72             Hero hero1 = new Hero(1, "刘备", "哭泣", true);
 73             map.Add(hero1.Name, hero1);
 74             Hero hero2 = new Hero(2, "官羽", "贪污", false);
 75             map.Add(hero2.Name, hero2);
 76             Hero hero3 = new Hero(3, "黄忠", "射击", true);
 77             map.Add(hero3.Name, hero3);
 78             Hero hero4 = new Hero(4, "魏延", "突击", true);
 79             map.Add(hero4.Name, hero4);
 80             Hero hero5 = new Hero(5, "马超", "单挑", false);
 81             map.Add(hero5.Name, hero5);
 82             Hero hero6 = new Hero(6, "曹仁", "防守", true);
 83             map.Add(hero6.Name, hero6);
 84         }
 85         public MainWindow()
 86         {
 87             InitializeComponent();
 88             InitDictionary();
 89             
 90             Binding binding = new Binding();
 91             binding.Source = map;
 92             binding.Path = new PropertyPath("Values");
 93             listViewHeros.SetBinding(ListView.ItemsSourceProperty, binding);
 94 
 95             //listViewHeros.ItemsSource = map.Values;        //可以使用这行来代替上面的binding 90~93
 96         }
 97 
 98         private void Button_Click(object sender, RoutedEventArgs e)
 99         {
100             map["官羽"].Name = "关羽";
101             map["官羽"].Skill = "单挑";
102         }
103 
104 
105     }
106 }

 

转载于:https://www.cnblogs.com/shawnzxx/archive/2012/11/10/2763544.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/474858.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

LeetCode MySQL 1045. 买下所有产品的客户

文章目录1. 题目2. 解题1. 题目 Customer 表&#xff1a; ---------------------- | Column Name | Type | ---------------------- | customer_id | int | | product_key | int | ---------------------- product_key 是 Product 表的外键。Product 表&#xff1…

统计学中常用的数据分析方法汇总

文章目录一、描述统计二、假设检验三、信服分析四、列联表分析五、相关分析六、方差分析一、描述统计 描述统计是通过图表或数学方法&#xff0c;对数据资料进行整理、分析&#xff0c;并对数据的分布状态、数字特征和随机变量之间关系进行估计和描述的方法。描述统计分为集中…

java组装树状结构数据集合_JAVA构建List集合为树形结构

package com.zving.tree;import java.util.ArrayList;import java.util.List;/*** 树形结构实体类* author clove*/public class Node {private int id;private int pid;private String name;private String type;private List children new ArrayList<>();public Node(…

过拟合(overfitting)和欠拟合(underfitting)出现原因及如何避免方案

文章目录欠拟合一、什么是欠拟合&#xff1f;二、欠拟合出现原因三、解决欠拟合(高偏差)的方法过拟合一、什么是过拟合&#xff1f;二、过拟合出现原因三、解决过拟合(高方差)的方法欠拟合 一、什么是欠拟合&#xff1f; 欠拟合是指模型不能在训练集上获得足够低的误差。换句…

斯坦佛编程教程-Unix编程工具(五)

Unix Shell 这个部分是总结一下在Unix shell中使用的大多数的命令。 文件命令 cd directory 改变路径&#xff0c;如果directory没有指明&#xff0c;那么就返回home目录。 pwd 显示当前路径。 ls 显示目录下的内容&#xff0c;ls -a会显示以点开头的文件&#xff0c;ls…

LeetCode MySQL 612. 平面上的最近距离

文章目录1. 题目2. 解题1. 题目 表 point_2d 保存了所有点&#xff08;多于 2 个点&#xff09;的坐标 (x,y) &#xff0c;这些点在平面上两两不重合。 写一个查询语句找到两点之间的最近距离&#xff0c;保留 2 位小数。 | x | y | |----|----| | -1 | -1 | | 0 | 0 | …

数据库开发设计规范及表结构设计原则

文章目录一. 命名规范二. 库表基础规范三. 字段规范四. 索引规范五. SQL设计①.正规化表设计原则②.SQL设计③.“三少原则”六. 行为规范一. 命名规范 1.库名、表名、字段名必须使用小写字母&#xff0c;并采用下划线分割 (1)MySQL有配置参数lower_case_table_names1&#xff…

python离散点的线性回归_用python玩点有趣的数据分析——一元线性回归分析实例...

http://python.jobbole.com/81215/本文参考了博乐在线的这篇文章&#xff0c;在其基础上加了一些自己的理解。其原文是一篇英文的博客&#xff0c;讲的十分通俗易懂。本文通过一个简单的例子&#xff1a;预测房价&#xff0c;来探讨怎么用python做一元线性回归分析。1. 预测一下…

[BTS] WCF-SAP Connect to SAP gateway failed

日志名称: Application来源: BizTalk Server日期: 2012/11/15 15:58:24事件 ID: 5743任务类别: (1)级别: 警告关键字: 经典用户: 暂缺计算机: AppTestSrv.AppCenter.xz描述:The ad…

LeetCode MySQL 1112. 每位学生的最高成绩

文章目录1. 题目2. 解题1. 题目 表&#xff1a;Enrollments ------------------------ | Column Name | Type | ------------------------ | student_id | int | | course_id | int | | grade | int | ------------------------ (student_id…

设计精美Power Bi报告的诀窍以及让人眼前一亮的精美Power Bi图表

文章目录设计精美Power Bi报告诀窍一、使用对齐工具二、一次调整多个视觉效果三、使用主题四、使用搜索更快地格式化五、添加令人惊叹的图像形状元素六、对数据使用适当的可视化效果让人眼前一亮的精美Power Bi图表Infographic DesignerWalkers Animated PictogramAnimated Bar…

python模块的函数_python模块内置函数

python提供了一个内联模块buildin&#xff0c;该模块定义了一些软件开发中经常用到的函数&#xff0c;利用这些函数可以实现数据类型的转换、数据的计算、序列的处理等。 模块的内置函数: 1、apply()&#xff1a;可以调用可变参数列表的函数&#xff0c;把参数存在一个元组或者…

大学英语四六各项分值

听力&#xff1a;248.5 听力客观题&#xff08;单选&#xff09;&#xff1a;25&#xff05;合177.5分每个7.1分&#xff1b;听力主观题&#xff08;复合式听写&#xff09;&#xff1a;10&#xff05;合71分&#xff0c;前八个每个3.55分共28.4分&#xff0c;后三个每个14.…

[Hands On ML] 7. 集成学习和随机森林

文章目录1. 投票分类2. Bagging、Pasting3. Out of Bag 评价4. 随机贴片与随机子空间5. 随机森林6. 极端随机树 Extra-Trees7. 特征重要程度8. 提升方法8.1 AdaBoost8.2 梯度提升8.3 Stacking本文为《机器学习实战&#xff1a;基于Scikit-Learn和TensorFlow》的读书笔记。 中文…

dll侧加载_WORD打开时出现加载DLL错误解决方法

WORD打开时出现加载DLL错误解决方法1、接下来看看解决办法&#xff0c;按组合键WIN R或者按开始---运行&#xff0c;打开运行窗口&#xff0c;2、在运行对话框中输入或者复制粘贴“%USERPROFILE%\AppData\Roaming\Microsoft\Templates”(注意双引号就不要输入咧)&#xff0c;输…

SQL Server时间函数

一、统计语句 1、–统计当前【>当天00点以后的数据】 SELECT * FROM 表 WHERE CONVERT(Nvarchar, dateandtime, 111) CONVERT(Nvarchar, GETDATE(), 111) ORDER BY dateandtime DESC2、–统计本周 SELECT * FROM 表 WHERE datediff(week,[dateadd],getdate())03、–统计…

LeetCode 635. 设计日志存储系统(map)

文章目录1. 题目2. 解题1. 题目 你将获得多条日志&#xff0c;每条日志都有唯一的 id 和 timestamp&#xff0c;timestamp 是形如 Year:Month:Day:Hour:Minute:Second 的字符串&#xff0c;例如 2017:01:01:23:59:59&#xff0c;所有值域都是零填充的十进制数。 设计一个日志…

PHP中file() 函数和file_get_contents() 函数的区别

PHP中file() 函数和file_get_contents() 函数的作用都是将整个文件读入某个介质&#xff0c;其主要区别就在于这个介质的不同。 file() 函数是把整个文件读入一个数组中&#xff0c;然后将文件作为一个数组返回。数组中的每个单元都是文件中相应的一行&#xff0c;包括换行符在…

ios 桥接文件找不到文件_电脑文件搜索神器,没有找不到的东西

随着工作或学习&#xff0c;使用电脑的时间增长&#xff0c;里面的文件也会越来越多。有时候想找某个文件&#xff0c;可能就突然忘了把它放在哪了。如果能想起文件名&#xff0c;那么还可以用电脑自带的搜索或者everything这类的软件进行搜索。但如果连文件名都忘了呢&#xf…

SQL行列问题

日常工作中&#xff0c;为了让数据的可读性更强&#xff0c;经常会对数据格式进行转化操作。总结一下日常工作中遇到的关于行列操作问题。 单行拆分成多行 --创建测试数据 CREATE TABLE fwj.customer ( id STRING, name STRING, mobiles STRING);INSERT INTO fwj.customer SEL…