wpf - Raising event in custom control -


I am writing custom text block control which populates hyperlinks and increases the event when clicking on the hyperlink.

I wrote this code, but I got stucked

My code is:.

  import System.Text.RegularExpressions public class CustomTextBlock TextBlock inherited public event Click If eventhandler (EventArgs) as the public Reedonli inline collection implants as DependencyProperty = DependencyProperty.Register ( "InlineCollection", GetType (String), GetType (CustomTextBlock), New Property Metadata (PrivateOpenChangedOfficeOflineOngline)) Private Shared Sub Inline Changed (DependencyObject as ByVal Sender, ByVal e DependencyPropertyChangedEventArgs) DirectCast (Sender, Cust omTextBlock) .Inlines.Clear () Dim kelimeler = Split (e.NewValue, "") for i = 0 kelimeler.Length - 1, so Regex.Match (kelimeler (i), "(http | ftp | Https): \ / \ / [\ w \ -_] (\ [\ w \ -_]) + ([\ w \ - \, @ ^ =% & amp;: / ..? ~ \ + #] * [\ W = -? \ @ ^ =% Amp; amp;?. / ~ \ + #]) "Success then dim x = new hyperlink (new run (kelimeler (i)) x.AddHandler (Hyperlink.ClickEvent, New RoutedEventHandler (AddressOf t_Click)) x.ToolTip = kelimeler (i) x.Tag = kelimeler (i) DirectCast (sender, CustomTextBlock) .Inlines.Add (x) when I = kelimeler.Length then DirectCast (Sender, CustomTextBlock) .Inlines.Add ("") or otherwise DirectCast (Sender, CustomTextBlock). Inlines.Add (kelimeler (i)) if not i = kelimeler.Length then Di rectCast (sender, CustomTextBlock) .Inlines.Add ( "") 'that end' // console .WriteLine (Kelime (i) .ToString.StartsWith ( "@")) Next kelimeler = Nothing End Sub Public Property InlineCollection string as in return receive DirectCast (getValue (InlineCollectionProperty), string) end get set (ByVal value as string) setValue (InlineCollectionProperty, value) end set end property Private shared sub hyperlink t_Click (ByVal, hyperlinks System in the form Vindojkroted avent Aarjis) e.Handled = True RaiseEvent is Klik (dispatcher, EventArgs.Empty) end end class  

This code error RaiseEventClik (sender, EventArgs.Empty)

There is an error: Can not mention an example instance of class between a shared method or a shared member initializer without a specified example of the class.

Thank you for your reply, Alper

The problem is obviously in the exception message Having said. The T_Click method is shared (which is normal for all instances of the class), so it can not raise an event that is specific to an example of a class. You should only extend the event with the method that is not shared.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -