To declare Hashtable or ArrayList in xaml, we need to include the System.Collection namespaces in XAML by using the below key
xmlns:col='clr-namespace:System.Collections;assembly=mscorlib'
After declaring the namespace we can use all the class of System.Collection namespace with col: prefix
Code to Declare the HashTable in XAML:
Code to Declare the ArrayList in XAML:
xmlns:col='clr-namespace:System.Collections;assembly=mscorlib'
After declaring the namespace we can use all the class of System.Collection namespace with col: prefix
Code to Declare the HashTable in XAML:
<col:Hashtable x:Key='hash'>
<col:DictionaryEntry x:Key='hashEntry1'
Key='1' Value='a'></col:DictionaryEntry>
<col:DictionaryEntry x:Key='hashEntry2'
Key='2' Value='b'></col:DictionaryEntry>
<col:DictionaryEntry x:Key='hashEntry3'
Key='3' Value='c'></col:DictionaryEntry>
<col:DictionaryEntry x:Key='hashEntry4'
Key='4' Value='d'></col:DictionaryEntry>
</col:Hashtable>Code to Declare the ArrayList in XAML:
<col:ArrayList x:Key='arrList'>
<sys:String>Ram</sys:String>
<sys:String>Shyam</sys:String>
<sys:String>Mohan</sys:String>
<sys:String>Rohan</sys:String>
</col:ArrayList>
No comments:
Post a Comment