diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index 56a84047..aabdf3da 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -209,6 +209,7 @@ + diff --git a/CampusAppWP8/CampusAppWP8/Pages/Links/LinkPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Links/LinkPage.xaml index 46d424fa..4d39009f 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Links/LinkPage.xaml +++ b/CampusAppWP8/CampusAppWP8/Pages/Links/LinkPage.xaml @@ -6,6 +6,7 @@ xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui.Button" mc:Ignorable="d" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" @@ -30,7 +31,7 @@ - + diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/LinkButton.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/LinkButton.cs new file mode 100644 index 00000000..ba86f874 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/Button/LinkButton.cs @@ -0,0 +1,82 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 08.07.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Utility.Lui.Button +{ + using System; + using System.Windows; + using System.Windows.Controls; + using System.Windows.Media.Imaging; + using CampusAppWP8.Resources; + using Microsoft.Phone.Tasks; + + /// + /// This class create an Button which start the Webrowser, which an certain url + /// + public class LinkButton : System.Windows.Controls.Button + { + #region Members + + /// + /// Register the EmailProperty + /// + public static readonly DependencyProperty LinkProperty = DependencyProperty.Register("Url", typeof(object), typeof(LinkButton), new PropertyMetadata(false)); + + /// + /// Icon of the Button + /// + private static BitmapImage icon = new BitmapImage(new Uri(Icons.Link, UriKind.Relative)); + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + public LinkButton() + : base() + { + this.Content = new Image + { + Source = icon + }; + } + + #endregion + + #region Proberties + + /// + /// Gets or sets the Url + /// + public object Url + { + get { return (object)this.GetValue(LinkProperty); } + set { this.SetValue(LinkProperty, value); } + } + + #endregion + + #region Methods + + /// + /// Overrides the OnClick-Method from button + /// + /// + /// now method start the WebBrowserTask + /// + protected override void OnClick() + { + Uri linkUrl = new Uri(this.Url as string, UriKind.Absolute); + WebBrowserTask webBrowserTask = new WebBrowserTask(); + webBrowserTask.Uri = linkUrl; + webBrowserTask.Show(); + } + #endregion + } +}