protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); InitTask(); OrderFields(); SetRichElementsState(); CategoryPresenter.DataContext = TaskCategory.GetById(task.CategoryId); this.DataContext = task; }
// For each category we want to display different fields. The rest of the fields remain in the advanced panel. private void OrderFields() { string[] categoryFields = TaskCategory.GetById(task.CategoryId).DefaultFields; if (categoryFields == null) { return; } for (int i = 0; i < categoryFields.Length; i++) { UIElement field = this.FindName(categoryFields[i]) as UIElement; if (AdvancedFieldsContainer.Children.Contains(field)) // in case of thombstoning { AdvancedFieldsContainer.Children.Remove(field); CategoryFieldsContainer.Children.Add(field); } } CategoryFieldsContainer.DataContext = task; }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { int categoryId = (int)value; return(TaskCategory.GetById(categoryId).IconUri); }