User avatar
Scherub
Topic Author
Posts: 141
Joined: 06 May 2014, 20:53
Contact:

[Unity] Inheriting from classes other than UserControl

15 Feb 2015, 15:52

I need to implement a special tab-like control that works similar to the WinPhone tab-like control. For that I need two new controls, my own custom TabControl inherited from Selector and another one inherited from HeaderedContentControl.

Before I start trying to implement it in Noesis I just wanted to be sure that's possible to achieve with the current v1.2. I'm asking because it was always said that you can only inherit from UserControl, other FrameworkElements don't provide everything you would need.
 
User avatar
Scherub
Topic Author
Posts: 141
Joined: 06 May 2014, 20:53
Contact:

Re: [Unity] Inheriting from classes other than UserControl

15 Feb 2015, 21:30

*sigh*

I started off writing this in WPF first. Due to the previously mentioned uncertainties I decided after a while to just use UserControls. That required a few more implementation details but in the end it works.
<local:SwipeTabControlView Background="SlateGray" Margin="20">
	<local:SwipeTabControlView.Tabs>
		<local:SwipeTabItemView Header="Header 1">
			<TextBlock Text="Content 1" />
		</local:SwipeTabItemView>

		<local:SwipeTabItemView Header="Header 2">
			<TextBlock Text="Content 2" />
		</local:SwipeTabItemView>

		<local:SwipeTabItemView Header="Header 3">
			<TextBlock Text="Content 3" />
		</local:SwipeTabItemView>	
</local:SwipeTabControlView>

After that I tried to convert it to NoesisGUI but failed miserably as apparently it is not possible to register any kind of collection as a dependency property. First I thought it affects only generic types but I'm not even allowed to use the non-generic IEnumerable. Am I just doing something wrong or is this really not supported? *sigh*

I'll also file a bug report.
 
User avatar
Scherub
Topic Author
Posts: 141
Joined: 06 May 2014, 20:53
Contact:

Re: [Unity] Inheriting from classes other than UserControl

15 Feb 2015, 21:40

Okay, it looks like Noesis.Collection is the only type of collection that works. But I thought this one is going to be deprecated/removed in v1.2?

Edit: Okay, I give up for now. The old collection doesn't have a CollectionChanged event.
 
User avatar
sfernandez
Site Admin
Posts: 3264
Joined: 22 Dec 2011, 19:20

Re: [Unity] Inheriting from classes other than UserControl

16 Feb 2015, 16:58

I answered these questions in the ticket you opened about the Collection property problem.
 
User avatar
jsantos
Site Admin
Posts: 4393
Joined: 20 Jan 2012, 17:18
Contact:

Re: [Unity] Inheriting from classes other than UserControl

17 Feb 2015, 15:36

I'm asking because it was always said that you can only inherit from UserControl, other FrameworkElements don't provide everything you would need.
Yes, you can inherit, although the functionality is quite limited right now. Basically you can extend any class adding new dependency properties and events but the expected virtual functions are yet not there (OnMouseMove, OnMouseEnter,...).

If you have a list of virtual functions you are missing, please file a bug and we will try to have them as soon as possible.

Who is online

Users browsing this forum: No registered users and 0 guests