{x:Reference ...} -> returns just a reference of an object it doesn't create that "bridge" between two properties like binding would do. Behind all that a service is being used that searches for the given name in a specific scope which is usually the window itself.

{Binding ElementName="..." } -> first of all it creates that binding object then it searches for the object name but not by using the same technique under the hood as x:Reference. The search algorithm moves up and/or down in VisualTree to find the desired element. Therefore a functional VisualTree is always needed. As example when used inside a Non-UiElement, it won't work. In the end the Binding stays and does its daily bread.

This won't work:

<StackPanel>
<Button x:name="bttn1" Visibility="Hidden">Click me</Button>
<DataGrid>
<DataGrid.Columns>
<DataGridTextColumn Visibility="{Binding ElementName=bttn1, Path=DataContext.Visibility}"/>
....

This works:

<StackPanel>
<Button x:name="bttn1" Visibility="Hidden">Click me</Button>
<DataGrid>
<DataGrid.Columns>
<DataGridTextColumn Visibility="{Binding Source={x:Reference bttn1} Path=DataContext.Visibility}"/>
....

Sort of like that :)

Difference between x:Reference and x:Name的更多相关文章

  1. Recover data from reference electrode via EEGLab 用EEGLab恢复参考电极数据

    The data of scanning reference electrode will not show initially. Here is a summary of recovering it ...

  2. STL迭代器之二:迭代器型别

    如果一个迭代器要兼容stl,必须遵循约定,自行以内嵌型别定义的方式定义出相应型别.根据书中介绍,最常用到的迭代器型别有五种:value type,difference type, pointer, r ...

  3. halcon中variation_model_single实例注释.

    * This example shows how to employ the new extensions of HALCON's variation model operators* to perf ...

  4. php面试题之三——PHP语言基础(基础部分)

    三.PHP语言基础 1. strlen( )与 mb_strlen( )的作用分别是什么(新浪网技术部) strlen和mb_strlen都是用于获取字符串长度. strlen只针对单字节编码字符,也 ...

  5. Git - Tutorial [Lars Vogel]

    From: http://www.vogella.com/tutorials/Git/article.html Git - Tutorial Lars Vogel Version 5.6 Copyri ...

  6. Git - Tutorial官方【转】

    转自:http://www.vogella.com/tutorials/Git/article.html#git_rename_branch Lars Vogel Version 5.8 Copyri ...

  7. STL——迭代器与traits编程技法

    一.迭代器 1. 迭代器设计思维——STL关键所在 在<Design Patterns>一书中对iterator模式定义如下:提供一种方法,使之能够依序巡访某个聚合物(容器)所含的各个元素 ...

  8. PHP面试题及答案解析(1)—PHP语法基础

    1. strlen( )与 mb_strlen( )的作用分别是什么? strlen和mb_strlen都是用于获取字符串长度.strlen只针对单字节编码字符,也就是说它计算的是字符串的总字节数.如 ...

  9. STL源码剖析——iterators与trait编程#2 Traits编程技法

    在算法中运用迭代器时,很可能用到其相应类型.什么是相应类型?迭代器所指对象的类型便是其中一个.我曾有一个错误的理解,那就是认为相应类型就是迭代器所指对象的类型,其实不然,相应类型是一个大的类别,迭代器 ...

随机推荐

  1. IETester for IE11, IE10, IE9, IE8, IE7 IE 6 and IE5.5 on Windows 8 desktop, Windows 7, Vista and XP

    简介: IETester是一个免费的(用于个人和专业用途)WebBrowser,允许您在Windows 8桌面,Windows 7,Vista和XP上拥有IE11,IE10,IE9,IE8,IE7 I ...

  2. POJ3020【二分匹配】

    思路: ---说给自己 一开始想的是从1-h*w标记整幅图,建图是星号和 {他,与他相连的星号} 建边,肯定要去匹配"*"啊,所以空格一定不会去造,然后就理解成了最小点覆盖,然而对 ...

  3. Unity的http通信--unity与python的django通信

    http://blog.csdn.net/chenggong2dm/article/details/17372203 写在前面: WWW类,是unity里,简单的访问网页的类.本文介绍的就是这种方式, ...

  4. [Xcode 实际操作]一、博主领进门-(11)代码区的样式设置,设置模拟器启动的声音

    目录:[Swift]Xcode实际操作 本文将演示如何对Xcode代码区进行样式设置,从而调整代码的外观属性.随便打开一份代码文件. [Xcode]->[Preferences]参数设置-> ...

  5. [Xcode 实际操作]二、视图与手势-(5)给图像视图添加圆角效果

    目录:[Swift]Xcode实际操作 本文将演示给矩形图片添加圆角效果 import UIKit class ViewController: UIViewController { override ...

  6. IT兄弟连 JavaWeb教程 JSP定义

    JSP页面是指扩展名为.jsp的文件,在一个JSP页面中,可以包括指令标识.HTML代码.JavaScript代码.嵌入的Java代码.注释和JSP动作标识等内容.但这些内容并不是一个JSP页面所必须 ...

  7. 用BeautifulSoup简单爬取BOSS直聘网岗位

    用BeautifulSoup简单爬取BOSS直聘网岗位 爬取python招聘 import requests from bs4 import BeautifulSoup def fun(path): ...

  8. Csc”任务不支持“SharedCompilationId”参数。请确认该参数存在于此任务中,并且是可设置的公共实例属性

    今天.NetCore2.1版本,建立Asp.net Core web应用程序项目时,报以下错误: 未能使用“Csc”任务的输入参数初始化该任务. “Csc”任务不支持“SharedCompilatio ...

  9. HDU-1029-Ignatius aned the Princess IV

    链接:https://vjudge.net/problem/HDU-1029#author=0 题意: 给你n个数字,请你找出出现至少(n+1)/2次的数字. 思路: dp,hash超时了,不知道是不 ...

  10. 计算机中如何实现除数是2的幂次的除法【转载自CSDN】

    前言: 本来是在看汇编里面的数据条件传送指令,做习题的时候看着这么一道有关于2的幂次方除法的题目.结果傻眼了,又尼玛不会了.........第二章看的时候就稀里糊涂的,看了几遍也没看太懂,这回又涉及到 ...