|
| 1 | +namespace AlAnvar.Views; |
| 2 | +public sealed partial class QuranItemUC : UserControl |
| 3 | +{ |
| 4 | + public QuranViewModel ViewModel |
| 5 | + { |
| 6 | + get { return (QuranViewModel) GetValue(ViewModelProperty); } |
| 7 | + set { SetValue(ViewModelProperty, value); } |
| 8 | + } |
| 9 | + |
| 10 | + public static readonly DependencyProperty ViewModelProperty = |
| 11 | + DependencyProperty.Register("ViewModel", typeof(QuranViewModel), typeof(QuranItemUC), new PropertyMetadata(null)); |
| 12 | + |
| 13 | + public string AyahText |
| 14 | + { |
| 15 | + get { return (string) GetValue(AyahTextProperty); } |
| 16 | + set { SetValue(AyahTextProperty, value); } |
| 17 | + } |
| 18 | + |
| 19 | + public static readonly DependencyProperty AyahTextProperty = |
| 20 | + DependencyProperty.Register("AyahText", typeof(string), typeof(QuranItemUC), new PropertyMetadata(default(string))); |
| 21 | + |
| 22 | + public string TranslationText |
| 23 | + { |
| 24 | + get { return (string) GetValue(TranslationTextProperty); } |
| 25 | + set { SetValue(TranslationTextProperty, value); } |
| 26 | + } |
| 27 | + |
| 28 | + public static readonly DependencyProperty TranslationTextProperty = |
| 29 | + DependencyProperty.Register("TranslationText", typeof(string), typeof(QuranItemUC), new PropertyMetadata(default(string))); |
| 30 | + |
| 31 | + public string AyaDetail |
| 32 | + { |
| 33 | + get { return (string) GetValue(AyaDetailProperty); } |
| 34 | + set { SetValue(AyaDetailProperty, value); } |
| 35 | + } |
| 36 | + |
| 37 | + public static readonly DependencyProperty AyaDetailProperty = |
| 38 | + DependencyProperty.Register("AyaDetail", typeof(string), typeof(QuranItemUC), new PropertyMetadata(default(string))); |
| 39 | + |
| 40 | + public static QuranItemUC Instance { get; set; } |
| 41 | + public QuranItemUC() |
| 42 | + { |
| 43 | + this.InitializeComponent(); |
| 44 | + Instance = this; |
| 45 | + |
| 46 | + if (QuranTabViewItem.Instance != null) |
| 47 | + { |
| 48 | + ViewModel = QuranTabViewItem.Instance.viewModel; |
| 49 | + } |
| 50 | + } |
| 51 | + |
| 52 | + private void TextBlock_Loaded(object sender, RoutedEventArgs e) |
| 53 | + { |
| 54 | + if (ViewModel == null) |
| 55 | + { |
| 56 | + return; |
| 57 | + } |
| 58 | + var textblock = sender as TextBlock; |
| 59 | + switch (textblock?.Tag?.ToString()) |
| 60 | + { |
| 61 | + case "Ayat": |
| 62 | + if (Settings.AyatForeground != null) |
| 63 | + { |
| 64 | + textblock.Foreground = ViewModel.AyatForeground; |
| 65 | + } |
| 66 | + break; |
| 67 | + case "AyatNumber": |
| 68 | + if (Settings.AyatNumberForeground != null) |
| 69 | + { |
| 70 | + textblock.Foreground = ViewModel.AyatNumberForeground; |
| 71 | + } |
| 72 | + break; |
| 73 | + case "Translation": |
| 74 | + if (Settings.TranslationForeground != null) |
| 75 | + { |
| 76 | + textblock.Foreground = ViewModel.TranslationForeground; |
| 77 | + } |
| 78 | + break; |
| 79 | + } |
| 80 | + } |
| 81 | +} |
0 commit comments