एक Freezable
वस्तु मार्कअप में घोषित फ्रीज करने के लिए शामिल है, तो आप Freeze
विशेषता का उपयोग एक्सएमएल नेमस्पेस http://schemas.microsoft.com/winfx/2006/xaml/presentation/options
में परिभाषित किया गया है।
निम्नलिखित उदाहरण में, SolidColorBrush
को पृष्ठ संसाधन और जमे हुए के रूप में घोषित किया गया है। इसका उपयोग तब बटन की पृष्ठभूमि को सेट करने के लिए किया जाता है।
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:po="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="po">
<Page.Resources>
<!-- This brush is frozen -->
<SolidColorBrush x:Key="MyBrush" po:Freeze="True" Color="Red" />
</Page.Resources>
<!-- Use the frozen brush -->
<Button Background="{StaticResource MyBrush}">Click Me</Button>
</Page>
स्रोत: Freezable Objects Overview
अंतिम विशेषता 'एमसी नहीं होना चाहिए: अज्ञात = "पीओ" '? – CodeNaked
@CodeNaked, मुझे विश्वास है कि आप सही हैं। संपादित। –