Monotouch custom controls, how? - c#

I want to create a custom ui control for my monotouch application.
My control consists in a view with 2 labels and 1 image. I need to re-use it more times.
Can i develop a custom uiview in monotouch? is possible to use custom controls in Interface Builder?
thanks.

Take a look at MonoTouch.Dialog

Related

Custom Control in Xamarin.Forms from scratch

I would like to write a custom control which will look like this one using Xamarin.Forms. I know that when we want to modify the existing control from Xamarin.Forms we are using Custom Renderers, but this control is something more than Entry and the solution is not obvious to me.
My question is how do I start working on this task? What control should I extend if I would like to use custom renderer? Is there some other more effective way to achieve this?
Looks like the linked control is extending a UIPickerView.
You have two options
Create the binding for https://github.com/nicklockwood/CountryPicker
Create your own Xamarin.Forms control, which is basically a custom renderer. You can refer the Forms source code to create the controls for it.
You should create a pure Xamarin.Forms view class and renderers (inherited from ViewRenderer) for each platform.
Please have a look at XLabs projects - it should be a good point to start:
Cross-platfrom view: Separator.cs.
Android renderer: SeparatorRenderer.cs.

How to create a custom label in WPF to be then used in WinForms

I would like to use a custom font for a Label in my WinForms project without installing the font. I found this as a solution, however it does not work since the FontStyle I want to use is Thin, which is not included in the System.Drawing.FontStyle enumerator.
Since I read instead that it should be quite easy in WPF to use such a custom font, I thought that a possible solution is to create a custom label (ThinLabel) in WPF and to host it in Winforms. Can you please instruct me on which is the proper way to create a custom label in WPF for this purpose? I read that in WPF controls can be customized in several ways (Styles, Data Templates,..) but I've no idea of which should be taken for this purpose. Please consider I've never used WPF so far.
In Order to implement WPF UserControls in Winforms you need to use and ElementHost
So if you want to create an WPF Label like you said in WPF you create a DLL project with your label inside it and reference it in your winforms project, after building you should be able to see a the UserControl with the label in the toolbox if not use an ElementHost

Own controls similar to TextBox in C# Windows application

Create own TextBox, Button etc control as own control using User control in C# Windows application, is this good idea?
I wanted make consistency for through out the application. Suppose if I want to change the Textbox border color then all forms textbox updated with this changes. It's just an example.
Please suggest me.
I don't recommend using UserControl just for consistency. If application skinning is what you are after, look into WPF. It makes it relatively simple to skin an application (or even a window, or smaller groups)
Here is an article on skinning with WPF: http://www.codeproject.com/Articles/19782/Creating-a-Skinned-User-Interface-in-WPF
Another alternative, staying within Windows Forms, is creating a class that inherits from TextBox, and using that class throughout the application. The Factory pattern would work well here. You could even adapt it to multiple skins.
It's not a bad idea to provide custom controls that match your "User Experience" (UX). It really just depends on what you are trying to accomplish with your program.

Custom look for C# windows applications

I'm making C# windows application ("Windows Forms Application") with default components, but I need to change default look of the form and all items on it (buttons, etc.) from classic windows style, to custom. How can I achieve it?
For example make buttons round, add transparency to some objects, make other objects with different shape, and so on.
It doesn't have to be customizable, but I just need to change it from default to something else. Maybe there's some components or something else that I can use? Or maybe there's additional GUI library that I can download and add to the project?
You didn't provide us with many details on how you want to customize the form.
You can change colors used on the form by setting the BackColor and ForeColor properties.
You can also apply background image to the form and use the TransparencyKey property in order to create a form with an irregular shape. More information about this method can be found here: http://msdn.microsoft.com/en-us/library/6k15y9et.aspx
Doing this manually and trying to have something looking nice takes waaay too much time. For start, look at this thread:
Best Free Controls for .NET

How to skin UI using Forms?

I'd like to know if is there a way to "skin" a Form and every widget used inside it. Images should be on background and other elements shall be setup accordingly.
In short, a way to implement a way to display the same Form in different flavors (i.e.: theme and eyecandy UI).
DevExpress makes a WinForms control suite with an excellent selection of skins.
Telerik also provides WinForms components with theme support. I've used their library and it works fine.

Categories