& lt窗戶。資源& gt
& ltSolidColorBrush?x:Key="myBrush "?color = " Blue "/& gt;
& lt風格?x:Key="myStyle "?TargetType="{x:Type?Button } " & gt
& lt二傳手?Property= "背景"?value = " Red "/& gt;
& lt/Style & gt;
& lt/窗口。資源& gtvar?贏?=?新的?windows 1();
var?刷?=?贏了。TryFindResource("myBrush ")?作為?刷;
var?風格?=?贏了。資源["myStyle"]?作為?風格;