Reputation: 131
I want to change an implicit style in the codebehind in C++, but the documentation doesn't give me any clear direction.
Basically, I want to do this (how it would be done in C#).
public MainPage()
{
this.InitializeComponent();
Windows.UI.Xaml.Style style = new Windows.UI.Xaml.Style { TargetType = typeof(FlipViewItem) };
style.Setters.Add(new Windows.UI.Xaml.Setter(FlipViewItem.IsTabStopProperty, false));
this.Resources.Add(style.TargetType, style);
}
But in C++. This makes sure that FlipViewItems aren't tab-stops by default.
Cheers, Tomas
Upvotes: 0
Views: 768
Reputation: 321
Try something like
auto comicFont= ref new Windows::UI::Xaml::Media::FontFamily("Comic Sans MS");
auto comicFontStyle = ref new Windows::UI::Xaml::Style(TextBlock::typeid);
auto fSetter=ref new Setter(TextBlock::FontFamilyProperty, comicFont );
comicFontStyle->Setters->Append(fSetter);
this->Resources->Insert(comicFontStyle->TargetType,comicFontStyle );
Upvotes: 1