incorporating leppies feedback it compiles - but IMO some drawbacks I want each sub class to be forced by the compiler to define their own Uri property. Code as it is now:
Here is a way to do it:
type IUriProvider =
abstract member UriString: string
abstract member Uri : System.Uri
[<AbstractClass>]
type UriUserControl() as this =
inherit System.Windows.Controls.UserControl()
abstract member Uri : System.Uri
abstract member UriString : string
interface IUriProvider with
member x.Uri = this.Uri
member x.UriString = this.UriString
Note that you have to provide an implementation of the interface (since all interface implementations in F# are explicit), but this can just refer back to abstract members in the class. Then you can subclass thusly:
type ConcreteUriUserControl() =
inherit UriUserControl()
override this.Uri = null
override this.UriString = "foo"
From a .NET point of view, you would need to at least provide an abstract implementation for the interface. But that again could proof problematic due to default interface accessibility, which would require some more glue again for an explicit implementation.