Silverlight: Custom Radio button - c#

I am trying to develop a custom radio button that looks like a two-option button control that looks somewhat as shown below with toggling of highlighted state. Not sure where to start.
Is there any such controls already available that I can use.

OK, here is a brief overview of what you will need to do ...
Firstly, you will need to change the ControlTemplate for the existing RadioButton control. There are lots of tutorials available that describe this,, for example this one.
Replace the standard template with some suitable markup for your illustration above. Perhaps a two column Grid?
Within each Grid cell add a Rectangle, one behind Option1, and the other behind Option2
Use the VisualStateManager to change the Fill property of each Rectangle based on the controls current VisualState. i.e. when Pressed toggle the background colours.
The steps above should help you achieve your goal. Please read the linked web pages and the Silverlight documentation. If you are still struggling after that,, come back and ask another question.

Related

Custom control creating

How can I make a custom button like in the image below? I searched on Google about custom control, but this is more special, is animated...
I know that on StackOoverflow are more questions like mine, but it is not a duplicate, I want to learn more about this particular button.
It is a button for WinForms.
you can create these buttons with GDI+ in C#,for example look at this one
On Windows form these buttons are made using the BackgroundImage Property of Button Control.
All you need is to toggle the background image on events like Click,OnMouseEnter etc.
This is not a custom control, this is CSS
Have a look at this, http://www.dynamicdrive.com/style/csslibrary/item/css_square_buttons/
You should possibly read something about gif-animation, jquery animation or css3 transitions to be able to animate backgrounds of such element

GridView selection color in WinRT Metro

How do I set / change the item selection color in XAML for a WinRT GridView control? I've tried looking around, is there also a procedure for doing it visually on Blend for VS11?
I've looked at GridView.ItemContainerStyle tag and I couldn't find much help online.
There was an earlier question that was asked about disabling tap visualization in a GridView that might help you.
Extracting the style of a GridViewItem is not available on the GridView itself, so if you want to do it yourself - you need to put a GridViewItem control separately in some page/user control and use the designer tool to edit the template. Or you can just use mine from that other question. I think what you would need to change is the use of the ListViewItemHighlightBrush in that template.

Slider and radio button styling in wpf

I'm trying to style some wpf user controls to make them look the same i have in my web application. I found some really great example for every control i need except for sliders and radio buttons.
Here is how they should look like:
Slider:
Radio Button:
I know i should create some ControlTemplate but i don't really know where to start...
If you can provide a complete example it would be perfect, but i guess that even some good deep advise would fit my needs.
Thank you 1000!
I have style sample here. It renders this:
I would start with Control Styles and Templates on MSDN pages. There are examples for most controls which give a good overview of how the control template works. Also you can extract/download the original control template and try to make your changes to it. Download default control templates
P.S. Actually the slider example on the first link resembles the one you describe.
Try using Expression Blend.
Learn Expression
and specifically this video: Creating ControlTemplates.
Expression Blend is something like a XAML design application - you can size, colour, adjust fill and stroke etc on all the elements in a control. It takes a little while to get used to, but you will be able to design controls with a graphical UI and Expression will provide you with the appropriate XAML to use in your project.

radiobutton styling in winForms?

Hey I was just wondering the techniques everyone uses to style radio buttons in winForms. I find them very plain, and would like to add some color or different images for the controls. The only way I can think of is to actually use a button that looks like a radiobutton, and set it to true or false.
Just wondering if there is a way I can do this, but still use the radio control.
Here is the RadioButton MSDN.
Here you can see that you can, like many Controls :
change the Button Apparence.
change the Button Color.
change the Button BackGroundImage.
There are many options to create your CustomRadioButton.
Here are two links which you can use to customize your controls
http://www.devexpress.com
http://www.dotnetskin.net

How can I change the default Control template of a TabControl according to my choice

I am trying to develop a Customize TabControl in which I'll divide the Whole TabControl into three Parts:
1)Tab Header
2)Common Region(for all Tab) and
3)Tab Content region for specific Tab
Update:
Please provide your best answers or samples if you have then, any type of help will be appreciated.
Thanks in Advance
You can overwrite the TabControl Template to be anything you want, including making it have a static region that stays visible regardless of which tab is selected.
Within the Template, I normally use a panel with IsItemsHost=True to define where the "Tab" portion of the tab control will be displayed and <ContentPresenter ContentSource="SelectedContent" /> where I want the selected tab content to be displayed.
The TabControl.ItemTemplate can also be overwritten to further define your Tabs, and TabControl.ItemContainer can be overwritten to modify just the TabContent part of the TabControl.
Hmm ... I don't quite understand why one would do this, but if I were you I would implement this using WPF.
I would implement the tab header as a StackPanel filled with Buttons (their style obviously needs to be redone so that it looks like tabs). The content would be a rectangle containing a grid whose content changes on clicking a button. And that's pretty much it for the basic sceleton. I don't understand your Common Region. What is also nice is to add a little "X" inside each tab in order to close it. That can be done with buttons as well.
It might make sense to use Expression Blend to create such a control.
Best wishes,
Christian

Categories