Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static Button CreateActionButton(AdaptiveAction action, AdaptiveRenderCon

if (!String.IsNullOrWhiteSpace(action.Style))
{
Style style = context.GetStyle($"Adaptive.{action.Type}.{action.Style}");
Style style = context.GetStyle($"Adaptive.Action.{action.Style}");

if (style == null && String.Equals(action.Style, "positive", StringComparison.OrdinalIgnoreCase))
{
Expand Down
29 changes: 20 additions & 9 deletions source/dotnet/Samples/WPFVisualizer/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
using ICSharpCode.AvalonEdit.Highlighting.Xshd;
using ICSharpCode.AvalonEdit.Highlighting;
using ICSharpCode.AvalonEdit.Document;
using System.Collections.ObjectModel;
using System.Threading;

namespace WpfVisualizer
{
Expand All @@ -32,6 +34,10 @@ public partial class MainWindow : Window
private bool _dirty;
private readonly SpeechSynthesizer _synth;
private DocumentLine _errorLine;
/*
// This variable exists so the sample styles are not added twice
private bool _stylesAdded = false;
*/

public MainWindow()
{
Expand Down Expand Up @@ -121,15 +127,20 @@ private void RenderCard()
AdaptiveCard card = parseResult.Card;

/*
// Example on how to override the Action Positive and Destructive styles
Style positiveStyle = new Style(typeof(Button));
positiveStyle.Setters.Add(new Setter(Button.BackgroundProperty, Brushes.Green));
Style otherStyle = new Style(typeof(Button));
otherStyle.Setters.Add(new Setter(Button.BackgroundProperty, Brushes.Yellow));
otherStyle.Setters.Add(new Setter(Button.ForegroundProperty, Brushes.Red));

Renderer.Resources.Add("Adaptive.Action.Submit.positive", positiveStyle);
Renderer.Resources.Add("Adaptive.Action.Submit.other", otherStyle);
if (!_stylesAdded)
{
// Example on how to override the Action Positive and Destructive styles
Style positiveStyle = new Style(typeof(Button));
positiveStyle.Setters.Add(new Setter(Button.BackgroundProperty, Brushes.Green));
Style otherStyle = new Style(typeof(Button));
otherStyle.Setters.Add(new Setter(Button.BackgroundProperty, Brushes.Yellow));
otherStyle.Setters.Add(new Setter(Button.ForegroundProperty, Brushes.Red));

Renderer.Resources.Add("Adaptive.Action.positive", positiveStyle);
Renderer.Resources.Add("Adaptive.Action.other", otherStyle);

_stylesAdded = true;
}
*/

RenderedAdaptiveCard renderedCard = Renderer.RenderCard(card);
Expand Down