// Token: 0x06004E49 RID: 20041 RVA: 0x0016061C File Offset: 0x0015E81C private static void OnHeaderChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { HeaderedItemsControl headeredItemsControl = (HeaderedItemsControl)d; headeredItemsControl.SetValue(HeaderedItemsControl.HasHeaderPropertyKey, (e.NewValue != null) ? BooleanBoxes.TrueBox : BooleanBoxes.FalseBox); headeredItemsControl.OnHeaderChanged(e.OldValue, e.NewValue); }
/// <summary> /// Prepare a PrepareHeaderedItemsControlContainer container for an /// item. /// </summary> /// <param name="control">Container to prepare.</param> /// <param name="item">Item to be placed in the container.</param> /// <param name="parentItemsControl">The parent ItemsControl.</param> /// <param name="parentItemContainerStyle"> /// The ItemContainerStyle for the parent ItemsControl. /// </param> private static void PrepareHeaderedItemsControlContainer(HeaderedItemsControl control, object item, ItemsControl parentItemsControl, Style parentItemContainerStyle) { if (control != item) { // Copy the ItemsControl properties from parent to child DataTemplate parentItemTemplate = parentItemsControl.ItemTemplate; if (parentItemTemplate != null) { control.SetValue(HeaderedItemsControl.ItemTemplateProperty, parentItemTemplate); } if (parentItemContainerStyle != null && HasDefaultValue(control, HeaderedItemsControl.ItemContainerStyleProperty)) { control.SetValue(HeaderedItemsControl.ItemContainerStyleProperty, parentItemContainerStyle); } // Copy the Header properties from parent to child if (control.HeaderIsItem || HasDefaultValue(control, HeaderedItemsControl.HeaderProperty)) { control.Header = item; control.HeaderIsItem = true; } if (parentItemTemplate != null) { control.SetValue(HeaderedItemsControl.HeaderTemplateProperty, parentItemTemplate); } if (parentItemContainerStyle != null && control.Style == null) { control.SetValue(HeaderedItemsControl.StyleProperty, parentItemContainerStyle); } // Note: this is where we would apply the HeaderTemplateSelector // (if implemented) or attempt to lookup the implicit template // for the type of the item if the headerTemplate were null. // Setup a hierarchical template HierarchicalDataTemplate headerTemplate = parentItemTemplate as HierarchicalDataTemplate; if (headerTemplate != null) { if (headerTemplate.ItemsSource != null && HasDefaultValue(control, HeaderedItemsControl.ItemsSourceProperty)) { control.SetBinding( HeaderedItemsControl.ItemsSourceProperty, new Binding { Converter = headerTemplate.ItemsSource.Converter, ConverterCulture = headerTemplate.ItemsSource.ConverterCulture, ConverterParameter = headerTemplate.ItemsSource.ConverterParameter, Mode = headerTemplate.ItemsSource.Mode, NotifyOnValidationError = headerTemplate.ItemsSource.NotifyOnValidationError, Path = headerTemplate.ItemsSource.Path, Source = control.Header, ValidatesOnExceptions = headerTemplate.ItemsSource.ValidatesOnExceptions }); } if (headerTemplate.IsItemTemplateSet && control.ItemTemplate == parentItemTemplate) { control.ClearValue(HeaderedItemsControl.ItemTemplateProperty); if (headerTemplate.ItemTemplate != null) { control.ItemTemplate = headerTemplate.ItemTemplate; } } if (headerTemplate.IsItemContainerStyleSet && control.ItemContainerStyle == parentItemContainerStyle) { control.ClearValue(HeaderedItemsControl.ItemContainerStyleProperty); if (headerTemplate.ItemContainerStyle != null) { control.ItemContainerStyle = headerTemplate.ItemContainerStyle; } } } } }
private void InitializeMapLegend(int d1, int d2, int d3, HeaderedItemsControl headeredIC, Location location) { List<MapLegendData> data = new List<MapLegendData>(); data.Add(new MapLegendData(d1 + "% (0 - 18)", new SolidColorBrush(Color.FromArgb(0xFF, 0x8E, 0xBC, 0x00)))); data.Add(new MapLegendData(d2 + "% (18 - 65)", new SolidColorBrush(Color.FromArgb(0xFF, 0x25, 0xA0, 0xDA)))); data.Add(new MapLegendData(d3 + "% (65+)", new SolidColorBrush(Color.FromArgb(0xFF, 0xEB, 0x7A, 0x2A)))); headeredIC.ItemTemplate = this.Resources["CustomDataTemplate"] as DataTemplate; headeredIC.Padding = new Thickness(0, 10, 0, 0); headeredIC.ItemsSource = data; headeredIC.SetValue(MapLayer.LocationProperty, location); this.VisualizationLayer.Items.Add(headeredIC); }
/// <summary> /// Prepare a PrepareHeaderedItemsControlContainer container for an /// item. /// </summary> /// <param name="control">Container to prepare.</param> /// <param name="item">Item to be placed in the container.</param> /// <param name="parentItemsControl">The parent ItemsControl.</param> /// <param name="parentItemContainerStyle"> /// The ItemContainerStyle for the parent ItemsControl. /// </param> private static void PrepareHeaderedItemsControlContainer(HeaderedItemsControl control, object item, ItemsControl parentItemsControl, Style parentItemContainerStyle) { if (control != item) { // Copy the ItemsControl properties from parent to child DataTemplate parentItemTemplate = parentItemsControl.ItemTemplate; if (parentItemTemplate != null) { control.SetValue(HeaderedItemsControl.ItemTemplateProperty, parentItemTemplate); } if (parentItemContainerStyle != null && HasDefaultValue(control, HeaderedItemsControl.ItemContainerStyleProperty)) { control.SetValue(HeaderedItemsControl.ItemContainerStyleProperty, parentItemContainerStyle); } // Copy the Header properties from parent to child if (control.HeaderIsItem || HasDefaultValue(control, HeaderedItemsControl.HeaderProperty)) { control.Header = item; control.HeaderIsItem = true; } if (parentItemTemplate != null) { control.SetValue(HeaderedItemsControl.HeaderTemplateProperty, parentItemTemplate); } if (parentItemContainerStyle != null && control.Style == null) { control.SetValue(HeaderedItemsControl.StyleProperty, parentItemContainerStyle); } // Note: this is where we would apply the HeaderTemplateSelector // (if implemented) or attempt to lookup the implicit template // for the type of the item if the headerTemplate were null. // Setup a hierarchical template HierarchicalDataTemplate headerTemplate = parentItemTemplate as HierarchicalDataTemplate; if (headerTemplate != null) { if (headerTemplate.ItemsSource != null && HasDefaultValue(control, HeaderedItemsControl.ItemsSourceProperty)) { control.SetBinding( HeaderedItemsControl.ItemsSourceProperty, new Binding { Converter = headerTemplate.ItemsSource.Converter, ConverterCulture = headerTemplate.ItemsSource.ConverterCulture, ConverterParameter = headerTemplate.ItemsSource.ConverterParameter, Mode = headerTemplate.ItemsSource.Mode, NotifyOnValidationError = headerTemplate.ItemsSource.NotifyOnValidationError, Path = headerTemplate.ItemsSource.Path, Source = control.Header, ValidatesOnExceptions = headerTemplate.ItemsSource.ValidatesOnExceptions }); } if (headerTemplate.IsItemTemplateSet && control.ItemTemplate == parentItemTemplate) { control.ClearValue(HeaderedItemsControl.ItemTemplateProperty); if (headerTemplate.ItemTemplate != null) { control.ItemTemplate = headerTemplate.ItemTemplate; } } if (headerTemplate.IsItemContainerStyleSet && control.ItemContainerStyle == parentItemContainerStyle) { control.ClearValue(HeaderedItemsControl.ItemContainerStyleProperty); if (headerTemplate.ItemContainerStyle != null) { control.ItemContainerStyle = headerTemplate.ItemContainerStyle; } } } } }