wpf-styles

How to reuse layouts in WPF

I'm trying to create a application that will be tabbed where each tab will have a button area and a view area. Now each tab will essentially have the same layout just different things in the layout and I wanted to be able to reuse the same layout so that I won't have to change at many places ( it's just not good programming ). Can I acc...

WPF How to change the listbox selected item text color when the list box loses focus

I've been searching for how to change the text color of a selected item in a list box that has lost focus. <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent"/> <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent"/> <SolidColorBrush x:Key="{x:Static SystemColors....

WrapPanel as ItemPanel for ItemsControl

Still fooling around with WPF and learning as I go. Trying now to build a dynamic grouping of controls ( mostly buttons but might include checkboxes and others ). I had no idea what was the best way to do this so I tried creating a ItemsControl style and then add the items into a itemspresenter inside a wrappanel. Soon realized the item...

WPF: Can I apply the same style to mulitple items at once?

This is my XAML fragment: <StackPanel Orientation="Horizontal" > <CheckBox Content="Sunday" IsChecked="{Binding Sunday}" Style="{StaticResource ResourceKey=GridChecks}"/> <CheckBox Content="Monday" IsChecked="{Binding Monday}" Style="{StaticResource ResourceKey=GridChecks}"/> <CheckBox Content="Tuesday" IsChecked="{Binding...

WPF: Resources in a GroupBox header

Can I do something like this? <GroupBox.Header> <GroupBox.Header.Resources> <Style TargetType="Label"> <Setter Property="Foreground" Value="White"/> </Style> </GroupBox.Header.Resources> ...

Setting VerticalAlignment property to all controls

My WPF UserControl contains two stack panels and each of them contains labels, text boxes and radio buttons. I would like to set VerticalAlignment property to Center to all controls in my UserControl with as little code as possible. Now I have following solutions: brute force - put VerticalAlignment="Center" in each control define o...

In WPF, how to set the style like fold paper tip to rectangle or any other control

I have managed to style a rectangle such that there is a fold paper tip image style in top right corner side. My requirement is I need to have style with multi-document view image. I can able to achive this below xaml. Now I need to set fold paper tip image style. Thanks in advance. RamaS <Window x:Class="ExpandTreeViewWPF.Window2" ...

WPF TabControl Templates + ItemContainerStyle

Hi All, I am attempting to create a Tab Control Style that basically looks like buttons at the top that are centered and content panel below that displays the tabitem content. I have am kind of new to templates but what I have so far works very well except one thing. I want to be able to set the default forground color for text element...

Exception: “Missing key value on ‘Storyboard’ object.” with styled triggers

I'm restyling a button, and that includes providing a controlTemplate and also adding some triggers (for mouseenter and mouseleave). My XAML is as follows: <Style TargetType="Button"> <Style.Resources> <Color x:Key="ForeColour" R="128" G="128" B="128" A="255"/> <Color x:Key="BackColour" R="211" G="211" B="211" A="...

Overriding themes in WPF

I have a got a small issue with the wpf project I am currently working on. I am new to WPF. In my app.xaml I am using the Microsoft Aero theme for my application. I have got something like this in my app.xaml <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/PresentationFramew...

Styling my WPF application like LightSwitch?

Hello! The LightSwitch look beautiful to me, and I'd like to implement these themes to my WPF apps as well. Is there a way I can mimic the LightSwitch themes to my app? ...

Custom styled listbox - how can I keep the style for a selected item?

I have a styled listbox. Listbox items change color when hovered over and when selected. Hover and select work fine. But when selecting an item then taking the mouse off it and coming back to hover over it causes it to go back to hover/unselected state even though it is still selected. How can I keep the listboxitem in a "selected" visua...

WPF Styling border thickness on trigger...

I have the following style defined... <!-- Blue Button --> <Style x:Key="BlueButton" TargetType="{x:Type Button}"> <Setter Property="OverridesDefaultStyle" Value="True"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <Border Name="border" BorderThickness...

Wpf CustomButton Toolbar Style

Hello, i have created a UserControl to make a ImageButton. But i replaced the the UserControl Item with a Button. < Button x:Class="myimagebutton" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:imagebutton"> <Grid x:Name="grdButton...

Change a style dynamically in WPF

Is there a way to change(and apply) a style dynamically in WPF? Say I have the style declared in XAML: <Style TargetType="local:MyLine" x:Key="MyLineStyleKey" x:Name="MyLineStyleName"> <Setter Property="Fill" Value="Pink"/> <Style.Triggers> <Trigger Property="IsSelected" Value="true"> ...

Why does the style change when I add an an accelerator to my button?

When I have my button's content as a normal string e.g. <Button Content="Ok" /> then button behaves as normal. But if I change the content to have a keyboard accelerator e.g. <Button Content="_Ok" /> the button's style changes to have different margins and sizes. I have a TextBlock style that doesn't have a key so is being applied to al...