/// <summary> /// Creates the template control. /// </summary> /// <param name="d">The definition.</param> /// <param name="template">The data template.</param> /// <returns>A content control.</returns> protected virtual FrameworkElement CreateTemplateControl(TemplateCellDefinition d, DataTemplate template) { var content = (FrameworkElement)template.LoadContent(); var binding = this.CreateBinding(d); binding.Mode = BindingMode.OneWay; var c = new ContentControl { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Content = content }; content.SetBinding(FrameworkElement.DataContextProperty, binding); this.SetIsEnabledBinding(d, content); this.SetBackgroundBinding(d, c); return(c); }
/// <summary> /// Creates the template control. /// </summary> /// <param name="d">The definition.</param> /// <param name="template">The data template.</param> /// <returns>A content control.</returns> protected virtual FrameworkElement CreateTemplateControl(TemplateCellDefinition d, DataTemplate template) { var content = (FrameworkElement)template.LoadContent(); var binding = this.CreateBinding(d); binding.Mode = BindingMode.OneWay; var c = new ContentControl { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Content = content }; content.SetBinding(FrameworkElement.DataContextProperty, binding); this.SetIsEnabledBinding(d, content); this.SetBackgroundBinding(d, c); return c; }