/
MarkdownButton.xaml.h
56 lines (49 loc) · 2.29 KB
/
MarkdownButton.xaml.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
// MarkdownButton.xaml.h
// Declaration of the MarkdownButton class
//
#pragma once
#include "MarkdownButton.g.h"
namespace SnooDom
{
public delegate bool HistoryResolverDelegate(Platform::String^ url);
[Windows::Foundation::Metadata::WebHostHidden]
public ref class MarkdownButton sealed
{
public:
static property Windows::UI::Xaml::Media::SolidColorBrush^ HistoryBrush;
static property Windows::UI::Xaml::Media::SolidColorBrush^ NoHistoryBrush;
static property HistoryResolverDelegate^ HistoryResolver;
MarkdownButton(Platform::String^ url, Platform::Object^ content);
private:
static Windows::UI::Xaml::DependencyProperty^ _realContentProperty;
static Windows::UI::Xaml::DependencyProperty^ _urlProperty;
public:
property UIElement^ RealContent
{
Windows::UI::Xaml::UIElement^ get() { return (Windows::UI::Xaml::UIElement^)GetValue(_realContentProperty); }
void set(Windows::UI::Xaml::UIElement^ value) { SetValue(_realContentProperty, value); }
}
// Using a DependencyProperty as the backing store for Markdown. This enables animation, styling, binding, etc...
static property Windows::UI::Xaml::DependencyProperty^ RealContentProperty
{
Windows::UI::Xaml::DependencyProperty^ get() { return _realContentProperty; }
}
property Platform::String^ Url
{
Platform::String^ get() { return (Platform::String^)GetValue(_urlProperty); }
void set(Platform::String^ value) { SetValue(_urlProperty, value); }
}
// Using a DependencyProperty as the backing store for Markdown. This enables animation, styling, binding, etc...
static property Windows::UI::Xaml::DependencyProperty^ UrlProperty
{
Windows::UI::Xaml::DependencyProperty^ get() { return _urlProperty; }
}
static void OnUrlChanged(Windows::UI::Xaml::DependencyObject^ d, Windows::UI::Xaml::DependencyPropertyChangedEventArgs^ e);
void RegisterDependencyProperties()
{
Windows::UI::Xaml::DependencyProperty::Register("RealContent", Windows::UI::Xaml::UIElement::typeid, Windows::UI::Xaml::UIElement::typeid, ref new Windows::UI::Xaml::PropertyMetadata(nullptr));
Windows::UI::Xaml::DependencyProperty::Register("Url", Platform::String::typeid, Platform::String::typeid, ref new Windows::UI::Xaml::PropertyMetadata(nullptr, ref new Windows::UI::Xaml::PropertyChangedCallback(OnUrlChanged)));
}
};
}