kimosavi
Active member
Hi,
I am trying to create a Hyperlink Custom Control to be used in WPF Page at to be able to setup at design time (properties/events ect).
As to my understanding Huperlinks in WPF cannot be used as UIElements by themselves. They need to be encapsuled in an UIElement (Like the Textbock)
usually in I would just do in XAML (XAML METHOD)
But I want to do this in a reusable class that I can create dynamically as well as at design time. So far I have done the following CUSTOM CLASS METHOD)
This works fine but there is no exposure to the Hyperlink at design time; all I see is the TextBlock Properties and events, but nothing from the Hyperlink... (different from the XAML METHOD which show both Elements separare and with it's own properties and event.
How can I achive the same results using code?
Thanks in advance!
I am trying to create a Hyperlink Custom Control to be used in WPF Page at to be able to setup at design time (properties/events ect).
As to my understanding Huperlinks in WPF cannot be used as UIElements by themselves. They need to be encapsuled in an UIElement (Like the Textbock)
usually in I would just do in XAML (XAML METHOD)
VB.NET:
<TextBlock>
<Hyperlink/>
</TextBlock>
But I want to do this in a reusable class that I can create dynamically as well as at design time. So far I have done the following CUSTOM CLASS METHOD)
VB.NET:
Class HyperBlock
Inherits TextBlock
Public Shared WithEvents Link As New Hyperlink
Private Sub HyperBlock_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
Link.Inlines.Add("Hyperlink")
MyBase.Text = Nothing
MyBase.Inlines.Add(Link)
End Sub
End Class
This works fine but there is no exposure to the Hyperlink at design time; all I see is the TextBlock Properties and events, but nothing from the Hyperlink... (different from the XAML METHOD which show both Elements separare and with it's own properties and event.
How can I achive the same results using code?
Thanks in advance!