Button Styles via xaml and expression blend - c#

I created a custom control that looks a lot like the tab buttons in VS 2012. In my control I could set a propertiy to posistion the text and sidebar vertical or horizontal. After playing around with the control I figured there was probably a better way to go about this. So i fired up the Expression Blend preview and suprising enough (only second or third time using blend) was able to create a style to achieve a simliar style button. However, Now I want to have control over the text and sidebar being vertical or horizontal. I would also like to have control over the mouse over color. Is this possible to do via one style or am i going to have to create a bunch of different styles?

If I understood correctly you can achieve what you want to do with event triggers.

Related

How to change the look of a UserControl dynamically in Blend?

I'm new to Blend and XAML, and I've got a UserControl containing just a white rounded off rectangle and a label with black text. However, when the UserControl is clicked, I want the rectangle to change to Blue and the label text to White, to emulate a sort of selected look. What is the best way to do this? I'm not familiar with XAML so I was hoping there'd be a solution where I can just set two templates for it in Blend, and then in that UserControl code window, have a click event handler where I just tell it to switch over to the other template. Thanks
The easiest - and designer friendliest - way to achieve this is to define two visual states. When the user clicks the control you can use the GotoStateAction to switch between the states.
Using visual states allows you to define everything visually without having to delve into code or XAML.
Hope it helps.

How to add button control in gmap.net wpf control?

Gmap.net wpf control has markers as item source. any idea how to add button control to it. i.e. transparent zoom in and out button?
Your best bet is to position the respective buttons above the map control, and use them to control the parameters of the map control.
Edit: I wouldn't try to include buttons to the control itself, easiest thing to do in WPF is to place custom UIContols as buttons on a layer above the map control, e.g. within a Grid layout. And then simply have button commands trigger the desired map functionalities such as zoom etc. Need a sample to get an idea? Or is my suggestion way from what you try to achieve?

It is possible to manually control tooltips in Windows 8 Store Apps?

I have a custom control. Can I show tooltip where I want and when I want? TooltipService and Tooltip classes don't help me, because don't contain appropriate members. Is there another way to implement custom tooltips?
Note that the ToolTip can be opened programmatically by setting IsOpen, and besides the top/left/bottom/right placement modes which are ideal for touch users, the mouse placement mode can position a tool tip relative to the touch/mouse point. If the provided tooltip placement modes don't suffice for your scenario, use a Popup (ToolTip uses one under the hood).

Docking buttons in the wpf panels

How can it be done? If there are, for example, four groups of buttons in menu-like panel. How would you dock them to their initial location if the window is resized?
I am trying this using DockPanel and HorizontalAlign, but it seems to only be work for the last button on the right when the window is resized. But how do you dock(anchor) a group of buttons? Maybe put them in border object and use HorizontalAlign for it? Is there more elegant way to do this?
To summarize the comments: I don't know your background but it seems you are used to another way of UI design where you do not explicitely have to specify grouping etc in code. While that might seem more elegant, it is not: the designer generated code is awful and the whole system is not as flexible nor srtaightforward as what WPF gives you..
With WPF you get a clear one-to-one relationship between your intent (treating buttons as a group within a layout) and the actual code (put the buttons in a stackpanel/grid/...). Or draw a border around buttons and organize them vertically within the border vs in xaml use a border with a stackpanel inside. It won't get any more elegant than that.
Read up on WPF layouts and once you'll get a grip of it you will quickly see that it is rather powerful and beatiful at the same time. I found this tutorial pretty helpful when just starting with layouts. And google provides lots and lots and lots more information, as usual.
Like stijn said, put the buttons in a Grid or a Stackpanel and you'll be fine.
You may not think it's beautifull, but it's the best solution for your problem.

Looking for suggestions on how to create an enhanced tooltip

currently I am using a tool tip to display information when it hovers over a region on a winform. This works well and I don't have any complaints, but the boss want's to display more complex data, that would best be displayed in a grid rather than text.
Is there a way that perhaps I could embed a usercontrol or a datagridview in a tool tip.
thanks
C#, .Net 2.0, windows.Forms
There's such a thing as an owner-drawn tooltip. You'd have to handle the painting of the grid yourself. You wouldn't get any interactivity, although a tooltip that lets you click and scroll sounds odd anyway.
If your boss is willing to spend money on this then I can happily recommend the DevExpress tooltip control, for its customisability.
You can write a custom control (shouldn't be too hard, just a yellow rectangle with a drop shadow) with a data grid on it. It just needs to fade out when the mouse moves away and get displayed after the mouse rests on it for a couple of seconds.

Categories

Resources