के आधार पर पृष्ठभूमि रंग सेट करें मैंने पहले कुछ जवाब देखा है लेकिन कुछ भी वास्तव में मेरी मदद नहीं करता है।डेटा-बाउंड मान
मैं भी एक वर्ग DecideModel
(यह एक डाटासेट डीबी से प्राप्त किया जाएगा, लेकिन इस सवाल के प्रयोजन के लिए, मैं एक ObservableCollection जोड़ लिया है), जो
static DecideModel()
{
All = new ObservableCollection<DecideModel>
{
new DecideModel
{
DatePerformed = new DateTime(2015, 4, 06),
Result = "Maybe"
},
new DecideModel
{
DatePerformed = new DateTime(2015, 4, 05),
Result = "No"
},
new DecideModel
{
DatePerformed = new DateTime(2015, 4, 04),
Result = "Yes"
}
};
}
public DateTime DatePerformed { set; get; }
public string Result { set; get; }
public static IList<DecideModel> All { set; get; }
}
शामिल मेरी XAML कोड में मैं
है<ContentPage.Resources>
<ResourceDictionary>
<Color x:Key="Maybe">#ffddbc21</Color>
<Color x:Key="Yes">#3CB371</Color>
<Color x:Key="No">#B22222</Color>
<Color x:Key="Depends">#ffd78800</Color>
</ResourceDictionary>
</ContentPage.Resources>
<Label Text="{Binding Result}" HorizontalOptions="FillAndExpand" BackgroundColor="{StaticResource {BindingSource Result}}" />
मैं गतिशील क्या परिणाम रहा वस्तु से प्राप्त किया है के संबंध में लेबल की पृष्ठभूमि का रंग निर्धारित करने की कोशिश कर रहा हूँ।
अगर आपको यह पता है कि इसे कैसे करना है, तो कृपया मुझे बताएं। मैं उपलब्ध किसी भी उपयोगी विकल्प की तलाश में हूं।
इसके लिए धन्यवाद! – rkc88