Exemple #1
0
        void RenderPaneTemplate(RenderContext context)
        {
            if (ItemsPanel == null)
            {
                return;
            }
            if (!(ItemsPanel is DataGrid))
            {
                throw new XamlException("Only DataGrid panel is supported");
            }
            var dg  = ItemsPanel as DataGrid;
            var tml = new TagBuilder("template");

            tml.MergeAttribute("slot", "pane");
            tml.MergeAttribute("slot-scope", "root");
            tml.RenderStart(context);
            using (var ctx = new ScopeContext(context, "itm", null))
            {
                ItemsPanel.RenderElement(context, (tag) =>
                {
                    tag.MergeAttribute(":is-item-active", "root.isItemActive");
                    tag.MergeAttribute(":hit-item", "root.hit");
                    tag.MergeAttribute(":items-source", "root.items");
                    if (ListSize != null && !ListSize.Height.IsEmpty && dg.FixedHeader)
                    {
                        // for fixed headers only
                        tag.MergeStyle("height", ListSize.Height.ToString());
                        tag.MergeStyle("max-height", ListSize.Height.ToString());
                    }
                });
            }
            tml.RenderEnd(context);
        }