Just include it Hyperlink
inside TextBlock
and use ValueConverter
to reference the network value.
inside: View.xaml
<TextBlock x:Name="FileNamePresenter" Grid.Row="1" Text="{Binding FileName}" Margin="0,0,0.001,0" HorizontalAlignment="Stretch" d:LayoutOverrides="Height" Width="Auto" Grid.Column="1" >
<Hyperlink x:Name="FileLink" NavigateUri="{Binding FileName, ConverterParameter=FileName, Converter={StaticResource FileConverter}}"/>
</TextBlock>
ValueConverter
namespace some.Helpers
{
public class JobFileConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
string FileLocationPath = "";
try
{
if (value != null)
{
FileLocationPath= string.Format(@"file://SomesServer/f$/SomeFile/{0}.pdf",value);
}
}
catch { }
return FileLocationPath;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
, , App.xaml( ) ...
<Application x:Class="some.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="clr-namespace:some.ViewModel"
xmlns:helper="clr-namespace:some.Helpers"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
StartupUri="JobList.xaml"
mc:Ignorable="d">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="someApp.xaml"/>
</ResourceDictionary.MergedDictionaries>
<vm:ViewModelLocator x:Key="Locator"
d:IsDataSource="True" />
<helper:JobStatusImageConverter x:Key="JobStatusConverter"/>
<helper:JobBindingImageConverter x:Key="JobBindingConverter"/>
<helper:JobFileConverter x:Key="FileConverter"/>
<Style x:Key="HeadingStyle" TargetType="{x:Type TextBlock}">
<Setter Property="TextWrapping" Value="NoWrap"/>
<Setter Property="TextTrimming" Value="None"/>
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect Color="#FFA52323" Direction="339" ShadowDepth="0"/>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</Application.Resources>