WPF Data binding: How to bind items in ItemsCollection to Grid.Row and Grid.Column? -


मेरे पास एक वर्ग है:

  सार्वजनिक वर्ग TempClass {सार्वजनिक इंक पंक्ति {get {return पंक्ति; } सेट {row = value; }} सार्वजनिक एट कॉलम {प्राप्त करें {रिटर्न कॉलम; } सेट {column = value; }} सार्वजनिक स्ट्रिंग मान {get {return.value; } सेट {this.value = value; }} Int पंक्ति; इंट कॉलम; स्ट्रिंग मान; सार्वजनिक TempClass (int पंक्ति, int स्तंभ, स्ट्रिंग मान) {this.row = पंक्ति; This.column = कॉलम; This.value = मान; }}   

मैंने एक सूची & lt; TempClass & gt; DummyCollection और मैंने इसे एक ItemsControl पर बाध्य किया है ItemsControl एक UniformGrid पैनल के लिए ItemsPanel संपत्ति का उपयोग करता है। यहां एक्सएएमएल कोड है:

  & lt; आइटमोंकंट्रोल आइटमों स्रोत = "{बाध्यकारी पथ = DummyCollection}" & gt; & LT; ItemsControl.ItemsPanel & gt; & LT; ItemsPanelTemplate & gt; & Lt; यूनिफ़ॉर्म ग्रिड पंक्तियाँ = "3" स्तंभ = "5" / & gt; & Lt; / ItemsPanelTemplate & gt; & LT; /ItemsControl.ItemsPanel> & LT; ItemsControl.ItemTemplate & gt; & Lt; डेटाटाइमप्लेट डेटाटाइप = "टेम्प्लक" & gt; & LT; बॉर्डर & gt; & Lt; टेक्स्टब्लॉक टेक्स्ट = "{बाइंडिंग}" / & gt; & Lt; / बॉर्डर & gt; & Lt; / DataTemplate & gt; & LT; /ItemsControl.ItemTemplate> & Lt; / ItemsControl & gt;   

मैं TempClass आइटम को ItemsControl में विशेष कक्ष में बाइंड करने में सक्षम होना चाहता हूं, अर्थात मैं रैम और कॉलम के गुणों को TempClass से मिलान करने के लिए आइटम कंटेनर के> ग्रिड। पंक्ति और ग्रिड। कॉलम गुण आइटम मैं इसे कैसे प्राप्त करूं? धन्यवाद।

  & lt; आइटमोंकंट्रोल & gt; & LT; ItemsControl.ItemContainerStyle & gt; & LT; शैली & gt; & Lt; सेटर संपदा = "ग्रिड। रोल" मान = "{बाध्यकारी पंक्ति}" / & gt; & Lt; सेटर संपदा = "ग्रिड। कॉलम" मान = "{बाध्यकारी स्तंभ}" / & gt; & Lt; / शैली & gt; & LT; /ItemsControl.ItemContainerStyle> ... & lt; / itemsControl & gt;    

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -