Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jwoo/wpf showcard style #3452

Merged
merged 6 commits into from Sep 19, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -134,18 +134,18 @@ public static void AddRenderedActions(Grid uiContainer, IList<AdaptiveAction> ac
Grid uiShowCardContainer = new Grid();
uiShowCardContainer.Style = context.GetStyle("Adaptive.Actions.ShowCard");
uiShowCardContainer.DataContext = showCardAction;
uiShowCardContainer.Margin = new Thickness(0, actionsConfig.ShowCard.InlineTopMargin, 0, 0);
uiShowCardContainer.Visibility = Visibility.Collapsed;
var padding = context.Config.Spacing.Padding;
// set negative margin to expand the wrapper to the edge of outer most card
uiShowCardContainer.Margin = new Thickness(-padding, actionsConfig.ShowCard.InlineTopMargin, -padding, -padding);
var showCardStyleConfig = context.Config.ContainerStyles.GetContainerStyleConfig(actionsConfig.ShowCard.Style);
uiShowCardContainer.Background = context.GetColorBrush(showCardStyleConfig.BackgroundColor);

// render the card
var uiShowCardWrapper = (Grid)context.Render(showCardAction.Card);
uiShowCardWrapper.Background = context.GetColorBrush("Transparent");
uiShowCardWrapper.DataContext = showCardAction;

// Remove the card padding
var innerCard = (Grid)uiShowCardWrapper.Children[0];
innerCard.Margin = new Thickness(0);

uiShowCardContainer.Children.Add(uiShowCardWrapper);
context.ActionShowCards.Add(uiAction, uiShowCardContainer);
// added the rendered show card as a peer
Expand Down
Expand Up @@ -66,6 +66,12 @@ public class ShowCardConfig
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public ShowCardActionMode ActionMode { get; set; } = ShowCardActionMode.Inline;

/// <summary>
/// Indicates the style of ShowCard
/// </summary>
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public AdaptiveContainerStyle Style { get; set; } = AdaptiveContainerStyle.Emphasis;

/// <summary>
/// If actionMode is inline this is the margin between the inline card and the actions
/// </summary>
Expand Down