Class MarkdownLinkConverter
Converts a string containing markdown style links to a System.Windows.Controls.TextBlock.
Inheritance
System.Object
System.Windows.Markup.MarkupExtension
MarkdownLinkConverter
Implements
System.Windows.Data.IValueConverter
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Sartorius.SAF.Presentation.Converter
Assembly: Sartorius.SAF.Presentation.dll
Syntax
public class MarkdownLinkConverter : ConverterExtensionBase, IValueConverter
Examples
The following example shows how to configure a MarkdownLinkConverter.
<saf:MarkdownLinkConverter x:Key="LinkConverter" TextBlockStyle="{markup:Style TextBlock}">
<saf:MarkdownLinkConverter.HyperlinkTemplate>
<DataTemplate DataType="{x:Type Hyperlink}">
<Hyperlink NavigateUri="{Binding NavigateUri}"
Style="{markup:Style Hyperlink}"
Command="{x:Static saf:RoutedCommands.OpenUriCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=NavigateUri, Mode=OneWay}"
TextDecorations="None">
<InlineUIContainer BaselineAlignment="Bottom">
<ContentControl Style="{markup:Icon OpenAttachment}"
Margin="5 -20 0 0">
<FrameworkElement.RenderTransform>
<TranslateTransform Y="5" />
</FrameworkElement.RenderTransform>
</ContentControl>
</InlineUIContainer>
<Span saf:SpanExtensions.Inlines="{Binding Inlines}" />
</Hyperlink>
</DataTemplate>
</saf:MarkdownLinkConverter.HyperlinkTemplate>
</saf:MarkdownLinkConverter>
The following example shows how to use a MarkdownLinkConverter.
<saf:MarkdownLinkConverter x:Key="LinkConverter" TextBlockStyle="{markup:Style TextBlock}">
<saf:MarkdownLinkConverter.HyperlinkTemplate>
<DataTemplate DataType="{x:Type Hyperlink}">
<Hyperlink NavigateUri="{Binding NavigateUri}"
Style="{markup:Style Hyperlink}"
Command="{x:Static saf:RoutedCommands.OpenUriCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=NavigateUri, Mode=OneWay}"
TextDecorations="None">
<InlineUIContainer BaselineAlignment="Bottom">
<ContentControl Style="{markup:Icon OpenAttachment}"
Margin="5 -20 0 0">
<FrameworkElement.RenderTransform>
<TranslateTransform Y="5" />
</FrameworkElement.RenderTransform>
</ContentControl>
</InlineUIContainer>
<Span saf:SpanExtensions.Inlines="{Binding Inlines}" />
</Hyperlink>
</DataTemplate>
</saf:MarkdownLinkConverter.HyperlinkTemplate>
</saf:MarkdownLinkConverter>
Properties
View SourceHyperlinkTemplate
Gets or sets the template for a hyperlink.
Declaration
public DataTemplate HyperlinkTemplate { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.DataTemplate |
TextBlockStyle
Gets or sets the style for the created System.Windows.Controls.TextBlock.
Declaration
public Style TextBlockStyle { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Style |
Methods
View SourceConvert(Object, Type, Object, CultureInfo)
Converts a value.
Declaration
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The value produced by the binding source. |
System.Type | targetType | The type of the binding target property. |
System.Object | parameter | The converter parameter to use. |
System.Globalization.CultureInfo | culture | The culture to use in the converter. |
Returns
Type | Description |
---|---|
System.Object | A converted value. If the method returns null, the valid null value is used. |
Overrides
Implements
System.Windows.Data.IValueConverter