惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - 鞠强

HBase初探 C#访问Azure的资源 HDInsight - 1,简介 Windows8.1画热度图 - 坑 使用windbg查看DependencyObject的属性 LiveSDK初始化/登录时失败的解决办法 开发WP版本的大菠萝英雄榜 SQL 2014 in-memory中的storage部分 Kinect 1 Diablo3狗熊榜 微软上海招聘有经验的.NET开发人员 塔防蜀的存档分析 我的HD2手机 和我一起作Tess的windbg lab,结束 和我一起作Tess的windbg lab - Lab7, MemoryLeak 和我一起作Tess的windbg lab - Lab6, MemoryLeak - 鞠强 和我一起作Tess的windbg lab - Lab5, Crash 和我一起作Tess的windbg lab - Lab4, High CPU 和我一起作Tess的windbg lab - Lab3, Memory
XAML绑定
鞠强 · 2013-04-13 · via 博客园 - 鞠强
public class Follower { 
  private List<Skill> skillList;
  Dictionary<string, Item> itemList = new Dictionary<string, Item>();

  public List<Skill> SkillList { get { return this.skillList; } }
  public Dictionary<string, Item> ItemList { get { return this.itemList; } }

如上是追随者的结构。如下绑定主手装备到XAML上

<Border BorderThickness="1" Height="96" Canvas.Left="149" Canvas.Top="164" Width="50" BorderBrush="{Binding ItemList[mainhand].BorderBrush}">
            <Border.Background>
                <ImageBrush ImageSource="{Binding ItemList[mainhand].BorderBackGround}"/>
            </Border.Background>
            <Image Source="{Binding ItemList[mainhand].ItemImage}" Height="96" Canvas.Left="596" Canvas.Top="120" Width="50" Margin="0,0,0,0" />
        </Border>

 注意的是代码中实际是ItemList["mainhand"].BorderBrush,而在XAML中,两个双引号是不能写的。

如果要绑定技能2到XAML上,如下,可以使用数字index。

<Border BorderThickness="1" Height="24" Canvas.Left="40" Canvas.Top="182" Width="24">
            <Border.Background>
                <ImageBrush ImageSource="{Binding SkillList[2].SkillImage}"/>
            </Border.Background>
        </Border>

 而如果要绑定collections的层级结构,则使用/即可。如下是msdn中path的解释

  • Use the Path property to specify the source value you want to bind to:
    • In the simplest case, the Path property value is the name of the property of the source object to use for the binding, such as Path=PropertyName.
    • Subproperties of a property can be specified by a syntax similar to that used in C#. For instance, the clause Path=ShoppingCart.Order sets the binding to the subproperty Order of the object or property ShoppingCart.
    • To bind to an attached property, place parentheses around the attached property. For example, to bind to the attached property DockPanel.Dock, the syntax isPath=(DockPanel.Dock).
    • Indexers of a property can be specified within square brackets following the property name where the indexer is applied. For instance, the clause Path=ShoppingCart[0] sets the binding to the index that corresponds to how your property's internal indexing handles the literal string "0". Multiple indexers are also supported.
    • Indexers and subproperties can be mixed in a Path clause; for example, Path=ShoppingCart.ShippingInfo[MailingAddress,Street].
    • Inside indexers you can have multiple indexer parameters separated by commas (,). The type of each parameter can be specified with parentheses. For example, you can have Path="[(sys:Int32)42,(sys:Int32)24]", where sys is mapped to the System namespace.
    • When the source is a collection view, the current item can be specified with a slash (/). For example, the clause Path=/ sets the binding to the current item in the view.
    • When the source is a collection, this syntax specifies the current item of the default collection view.
    • Property names and slashes can be combined to traverse properties that are collections. For example, Path=/Offices/ManagerName specifies the current item of the source collection, which contains an Offices property that is also a collection. Its current item is an object that contains a ManagerName property. Optionally, a period (.) path can be used to bind to the current source. For example, Text="{Binding}" is equivalent to Text="{Binding Path=.}".

补充一下,WP8开发中,app bar的icon,要求很龌龊:透明、alpha、白色前景。

我在Mspaint中画不出来,不知道怎么搞透明背景。后来搞定的方式是,vs2012中打开sdk中带的icon,把原有的select/delete掉,然后画上我自己要求的文字。 

 代码如下,出现错误,不能operated在这个stream上

public static BitmapImage GetBitmapFromIsolatedFolderByName(string file)
        {
            BitmapImage image = new BitmapImage();
            
            var stream = localFolder.OpenFile(cachePath+"\\"+file, System.IO.FileMode.Open);
            image.SetSource(stream);
            stream.Close();

            return image;

        }

 重点在于红色那一行,如果不close,那么第二次就会发生这个exception。令人发指的是,发生exception的时候,callstack都是reflection的东西,看不到真正的root cause。