I have been looking on the net for some way to change the look of a basic radiobutton in silverlight. Say I want the actual button to have a blue border and a yellow background. And when its checked I want the little circle that fills in the radio button to be red. I wanna do this for the radio button on the windows phone.
Take a look at this article to do it in raw XAML:
http://msdn.microsoft.com/en-us/library/cc189093(v=vs.95).aspx
If you have Expression Blend, it can automatically generate the control's default XAML style for you to customize. Right click on the element and click Edit Template | Edit a Copy...
Related
I have a problem developing a custom menu item.
The menu item is hosted in a ToolStripControlHost, the rest are just ToolStripMenuItems.
What I want is that when the user hovers the mouse over the custom control, to be selected like an ordinary ToolStripMenuItem, like in the image below. Unfortunately, I did not manage to figure this out. Is this behavior possible?
Edit: 26.10.2015:
I have been playing around with the control and it seems that the ToolStripControlHost, when added to the ContextMenu it is shrinked in the list, like in the image below.
I made the background of the custom control red so it can be seen better. The control only receives MouseHover events only when the mouse is over the control, shown in red. If you point the mouse on the left or the right, the ContextMenu receives the events.
ContextMenu custom menuitem
It is an interesting behaviour, because also the ToolStripTextBox or ToolStripCombobox don't take the whole left to right space and are not highlighted when mouse is over.
Now I hope someone has an idea how to do that.
I am building a wpf ribbon application. When certain buttons are clicked on, I would like the background to remain "lit up" like when the mouse is over it. I don't want to change the default mouseover color, I just want to replicate it when the button is pressed for "modal" type commands. Is there a way to do this? In MFC programming it would be like adding the "BS_PUSHLIKE" style to the button where it remains lit while active. Thanks for any help you can provide.
I am not sure exactly what you are looking for, but I believe the equivalent of "BS_PUSHLIKE" in WPF is the ToggleButton control.
I am having an issue about buttons in silverlight on windows phone 7. My button has a background image, and as I press it, it goes white like all the buttons in wp7 by default. What I want it to do, is to change its background image to different one. I found topic that describes something quite similar, but regarding the button color Windows Phone 7 (WP7) Change a button's background color on click.
Problem is that whenever I adjust any of the basic styles (Pressed, Disabled etc), I can only change everything besides the background image, because when I change it for one style, it stays changed for all the rest of them.
How can I make button change its background image while going into Pressed state? And why cant I do it the way the above link says?
ImageButton for Wp7 http://silvergeek.net/2011/01/14/imagebutton-control-for-win-phone-7/
If its not exactly what you need it might give you some hints.
I have a button that is programatically created, it's content is a stack panel with an image and a textblock. This all works great.
I want to make the button behind the image and text transparent, so that the image and text looks like it's sitting on the background, but still have all the properties of the button (i.e. someone clicks in the button region it still registers the button click event).
I have been playing with opacities, but every opacity I play with dealing with the button seems to set the whole button (image and text included) to that opacity value as well.
How can I make the button opaque while making the text and image content still visible?
Oh, this is silverlight 3. Thanks in advance.
You are going to have to template the button and remove the gradients, focus element, etc that you don't want to keep from the default style for a button. It sounds like you probably just want to keep the content presenter and get rid of the background and mouse over "glow" gradients. You will probably have to set the background of your StackPanel content to be transparent if you want the entire button area to intercept mouse events and not just the underlying image and text content.
Scott Gu has a good tutorial here on the basics of creating a control template.
If you are using Expression Blend it's very easy to right-click on the button and choose Edit Template -> Edit a Copy to copy the default style into a new style resource for the button where you can then manipulate the template right in Blend.
You can override the template property of the button to make an empty grid, like so:
<Button>
<Button.Template>
<ControlTemplate TargetType="Button">
<Grid />
</ControlTemplate>
</Button.Template>
</Button>
This could be set as a reusable style if needed.
I have a button with a transparent background on a wpf window.
Problem is, when I open up another window with a .showdialog the form becomes disabled as does the button, causing the button to go white (and stick out like a sore thumb); the same happens to the listview and textbox controls. Labels and group boxes aren't impacted in this way and remain looking fine.
How do I preserve the transparency color of the button, listview and textboxes when they are disabled?
Thanks, Rob
I'm not sure what your button template looks like, I would recommend posting your XAML. But check out the MSDN Docs on Button Templating