Toggle Button - Beveled Effect - wpf

I've been trying to create a toggle button with a "simple" bevel effect for my WPF Window. At first I've tried to apply the BevelBitmapEffect but apparently it is not deprecated and there are no visual changes when applied.
I've have tried many other "tweaks" with no success.
The kind of button I'm going for is something like this:
Edit: I was able to create this effect by having two pictures (unpressed and pressed). Still, if anyone knows how to do this without any external resources that would be great.

You have two options for this,
Create a Style for the ToggleButton that gives the desired look, this page has an example of a simple style for a toggle button.
Make a toggle button custom control, which is the same idea but can be a bit simpler if you need to use the same style in multiple places or applications.

Related

Image Button with no border that works like a toolbar button?

I want a button that
Displays an image with NO border, NO background, NO text
If I tab into the imagebutton, THEN it shows the background and border
Also if I hover over it, it shows the background and border
I've searched and I've tried so many different things, but nothing it exactly what I want. I've tried setting various properties on the button to make the background and border transparent, but it still shows up. I've tried a style with a custom control template. I'd rather not have to completely reinvent all the triggers etc to get the button to render on mouse over. The biggest problem with custom control template is that then I loose all existing functionality and I'm basically building a new control from the ground up.
Here is another link that came closest to what I wanted but it doesn't properly work for me.
How do you completely remove the button border in wpf? - BUT.... for some reason the hover effect gets stuck. One I mouse over the image and the button border draws, it stays stuck on until I click somewhere else.
Actually, you will want to override the control template. You're not "losing" any functionality (aside from the UI triggers).
Original/Default Template -- This is a good starting point... copy/paste that into you're XAML (wherever you want to style this button... ie Button resources, UserControl/Window resources, App Resources?). From there make your adjustments.
Another easy way is to use Expression Blend. You can easily create a new template based on the existing template, and the styling/authoring tools it provides are much better than hand-coding XAML (unless you're good at doing that).
As far as displaying an image instead of text, just set the image as the content. A Button is a type of ContentControl which means that it can house any type of content (Object).

Winform TabControl style

I'm once again turning to you since I can't find an answer anywhere else. I have a TabControl, but I want to get rid of the ugly orange bar on top of the selected tabs. I would also like to make the tab text BOLD when selected and NORMAL when not.
Is there any easy way to achieve that goal ? I don't want to use the Appearance Buttons or Flat Buttons.
Thanks for your help !
This appearance is controlled by the Visual Styles theme selected in your operating system. In general, users do not appreciate any program that ignores their theme settings, especially when they paid money for a custom one. But you can get what you want, you'll have to set the DrawMode property to OwnerDrawFixed and implement a handler for the DrawItem event. There's a good example to get you started in the MSDN Library article for this event. Just change the font assignment in that sample code.

WPF Button Styling with OuterGlowBitmapEffect

I have managed to style a button such that there is a the background I wanted (Normal). However, I want to create an OuterGlowBitmapEffect on the content. Also, when I modify the style, it reverts to the default for MouseOver, Pressed, and HasFocus.
Here is the image of what I want, how could you do this using WPF Styles
http://tinypic.com/r/2s9ybfs/5
Without seeing your code I can't say for sure, but you need to add the "OuterGlowBitmapEffect" to the MouseOver, Pressed and HasFocus styles as well.
All these states come as a package and need to be modified in concert.
If you can, get hold of Expression Blend. This has options for creating templates and styles from existing ones and then for modifying the individual components of each aspect of the style.

how can i change controls when a button is pressed in xaml

i am trying to create a wpf app and have different parts in user controls.
in the navigation i have some buttons (now using the ribbon ctp). is it possible to change the main user control when different buttons are pressed in xaml. or is this just a bad way to do things?
sorry, really new to xaml and im trying to get my head arround it.
Further to what Carlo has said,
The way we do it is to have a blank grid in the place you want your controls to all appear and then use BlankGrid.Children.Clear() and BlankGrid.Children.Add() to set up which control is visible in this position.
We found that was the nicest programatically as we have a large number of custom controls, but Carlo's method would work nicely if you wanted to use the designer.
I think this is a pretty regular procedure in WPF. In my experience, me and other programmers put the controls where we want to show them and make their visibility hidden, collapsed or visible depending on what we want to show the user.

Best way to modify Button behavior and Content, but maintain styles?

I'm trying to create a control in Silverlight that inherits from Button so that I can perform a specific action everytime it is clicked. I'm doing this because I'd like to reuse this custom button in several locations with the same functionality.
I'd like to create the control in such a way so that I have a can set the custom Button's Content to a specific default icon image, but still have the rest of the button's style coming from either the default button style, or being automatically set by the toolkit Themes.
I'd also like to have the Content be described and editable in XAML rather than code if possible.
It seems like this would be a pretty common problem for Silverlight developers - is there a good way to tackle it?
If you use a normal button and edit an "Empty Template", then you can style the button to have any content you wish and expose properties that you can set in the XAML for Icons etc.
By using the standard button control, you will have all the behaviors that you require.
I believe this is what you're looking for, if not can you expand on your question.
--EDIT--
Ok, I get what you are trying to do now. So what you might want to consider is creating a custom button class that inherits from Button. Then you can override the OnClick method to handle your logic. When it comes to the XAML, you can create a template style for a TargetType of your custom button class, that would be styled to your requirements.
HTH, if you need some examples place a comment and I'll mock up some examples

Resources