using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Data; namespace Technewlogic.Crud.Controls { [TemplatePart(Name = "PART_PropertyPanel", Type = typeof(Panel))] [StyleTypedProperty(Property = "DescriptionStyle", StyleTargetType = typeof(TextBlock))] // TODO public class PanelBase : TemplatedControl { private Panel _detailsGrid; static PanelBase() { DefaultStyleKeyProperty.OverrideMetadata( typeof(PanelBase), new FrameworkPropertyMetadata(typeof(PanelBase))); } public void AddField(string description, UIElement value) { // TODO: Styling (siehe StyleTypedPropertyAttribute oben) TextBlock tbDescription = new TextBlock() { Text = description + ":" }; _detailsGrid.Children.Add(tbDescription); _detailsGrid.Children.Add(value); } public void ClearFields() { _detailsGrid.Children.Clear(); } public override void OnApplyTemplate() { base.OnApplyTemplate(); AssignTemplateControl(ref _detailsGrid, new WrapPanel(), "PART_PropertyPanel"); } } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)