public static FrameworkElement Render(AdaptiveCard card, RenderContext context)
        {
            var outerGrid = new Grid();

            outerGrid.Style = context.GetStyle("Adaptive.Card");
#if WPF
            //TODO for Xamarin
            outerGrid.Background = context.GetColorBrush(context.Config.ContainerStyles.Default.BackgroundColor);
#endif

            outerGrid.SetBackgroundSource(card.BackgroundImage, context);

            var grid = new Grid();
            grid.Style  = context.GetStyle("Adaptive.InnerCard");
            grid.Margin = new Thickness(context.Config.Spacing.Padding,
                                        context.Config.Spacing.Padding,
                                        context.Config.Spacing.Padding,
                                        context.Config.Spacing.Padding);

            grid.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(1, GridUnitType.Star)
            });

            var inputControls = new List <FrameworkElement>();
            XamlContainer.AddContainerElements(grid, card.Body, context);
            XamlActionSet.AddActions(grid, card.Actions, context);

            outerGrid.Children.Add(grid);
            return(outerGrid);
        }
Beispiel #2
0
        public static FrameworkElement Render(Column column, RenderContext context)
        {
            var uiContainer = new Grid();

            uiContainer.Style = context.GetStyle("Adaptive.Column");

            XamlContainer.AddContainerElements(uiContainer, column.Items, context);

            if (column.SelectAction != null)
            {
                var uiButton = (Button)context.Render(column.SelectAction);//, new RenderContext(this.actionCallback, this.missingDataCallback));
                if (uiButton != null)
                {
                    uiButton.Content = uiContainer;
                    uiButton.Style   = context.GetStyle("Adaptive.Action.Tap");
                    return(uiButton);
                }
            }

            return(uiContainer);
        }