styles

How can I apply a style to the Window Control in WPF?

I am setting a style for the Window in the App.xaml like such: <Application x:Class="MusicRepo_Importer.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:System="clr-namespace:System;assembly=mscorlib" StartupUri="TestMaster.xaml"> <Application.Resourc...

Open XML Spreadsheet style error

I've used the Open XML Format SDK 2.0 to create a simple excel document. Opening the document in Excel first requires Excel to open it. I've narrowed this down to the CellFormats within the Stylesheet. The contents of which are below: <x:styleSheet xmlns:x="http://schemas.openxmlformats.org/spreadsheetml/2006/main"&gt; <x:numFmts coun...

Does anybody use page-break-before style for PDF or XPS generation?

I'm using a product called WebGrabber from ActivePDF, which programmatically generates PDF from web pages. This tool has two rendering engines, a native one that does not honor CSS stylesheets so its not usable for my app and IE thats the one I use. I need to generate some intentional pagebreaks and I've added some <p style="page-break...

Is it possible to set a style in XAML that selectively affects controls?

In <Window.Resources> I have defined following style: <Style x:Key="textBlockStyle" TargetType="TextBlock"> <Setter Property="Margin" Value="5,0,5,0"/> </Style> I have defined some grid where I have four TextBlocks: <WrapPanel> <TextBlock Style="{StaticResource textBlockStyle}">Server</TextBlock> <...

ASP.NET MenuItem Individual Styles

I'm hoping to use an ASP.NET Menu Control for navigation through my site. However, I've got a requirement that each MenuItem must be styled differently (different colors, both static, and onHover). Without creating a custom class that would inherit from MenuItem, is this possible? Thoughts on a better solution? ...

How do I remove the focus rectangle from a silverlight textbox control

Hi guys, Does anyone have any ideas on how I can remove the focus rectangle from a silverlight textbox? (I'm talking about the blue rectangle that appears when you click on the texblock to start typing) I'm looking through the default style and template for the textbox but can't seem to figure out which element to tweak. Thanks! ...

How to manage styles for child components?

How does one define a default style for a custom Flex component? was a good start, but I want to create custom styles for my custom component which contains other components. The custom component is a Canvas. It contains other Canvases, Buttons, Lists, etc. I do not want to have the child components use the same values as the parent com...

How to make WPF resource styles switchable at runtime?

I've got style resources in WPF working so that in my App.xaml I can define whether the customer or administrator layout is used. This works nicely by getting all the style out of the main XAML in a HTML/CSS-like fashion. Now how do I make this dynamic so that I can click on a button in my application and switch the layout between cust...

Silverlight: Applying datacontext to an element within a style

List item I have defined a style in app.xaml. This style contains several text TextBlocks which I would like to controle as I apply the style to an object, in this case a UserPin. How can I access these TextBlocks runtime? I get the style by: Style = Application.Current.Resources["UserPin"] as Style; The style looks like this: <Sty...

CSS & Overriding Styles on Nested Elements

This came up from another question that was asked here but I figure it's something that probably has a "Best Practice" Approach. When designing a website, the designer will most likely put together a set of generic styles for all elements within a website. (Standard Fonts for Text in Divs/Spans/H1/H2s) In the case of tables, they may b...

silverlight - reusing components

I am trying to create some reusable components in Silverlight2. The difficulty comes when my components are using templates/styles that are shared with other components. From what I know, in silverlight you can add the style/template in the component itself (not good enough due to duplicate styles) or in the main app file (this does n...

Can you define multiple TargetTypes for one XAML style?

In HTML/CSS you can define a style which can be applied to many types of elements, e.g.: .highlight { color:red; } can be applied to both P and DIV, e.g.: <p class="highlight">this will be highlighted</p> <div class="highlight">this will also be highlighted</div> but in XAML you seem to have to define the TargetType for styles,...

CSS Selectors

What is the difference between these two CSS statements: h1 em { color:#ddd; } and h1 > em { color:#ddd; } As far as I can tell they do exactly the same thing (though according to what I've read at W3C in the first case em is considered a 'descendant' where as in the second it is considered a 'child', though I have no idea how tha...

WPF - ListBox Background Color - CodeBehind

Hello, I am attempting to set the background color for a list box in code. I can get it to work with the list box item, but not the list box itself. Here is the code that works (with the ListBoxItem): private void SetBackgroundGradient() { var styleListBox = new Style(typeof(ListBoxItem)); var myBrush = ne...

Can WPF themes be used to include multiple skins for an application that can be changed at runtime?

WPF allows a control library to provide different resource dictionaries for different system themes, essentially allowing an application to match the operating system's selected visual theme (Aero, Luna, etc). I'm wondering if I can include multiple theme resource dictionaries with my application and utilise some existing theme support ...

What kind of cascading or multiple-style functionality do I have with XAML Styles?

I have a DockPanel with "StackPanel rows". I need each StackPanel row to get the same style, however, the FIRST StackPanel row which should get one addition style. In CSS I would do this using the cascading feature which I don't seem to have in XAML styles. Is it possible then to have multiple styles as shown in the pseudo code below? ...

AS3: Setting default font, color, etc. of a TextField using the StyleManager class

I'm trying to get StyleManager to have some effect, to no avail. package { import flash.text.*; import flash.display.Sprite; import fl.managers.StyleManager; public class StyleManagerExample extends Sprite { public function StyleManagerExample():void { StyleManager.setComponentStyle(TextField, "selectable", false); ...

How to I stop Vista from pulsating my focused XAML buttons?

I've created a style for buttons in my WPF application. However, on Vista, when a button is focused, it pulsates with a light blue that doesn't look good in the design. How can I override this automatic pulsating? <Style x:Key="NavigationButtonStyle" TargetType="Button"> <Setter Property="Width" Value="400"/> <Setter Property=...

How can I apply multiple XAML styles to one element?

I have a toolkit:DataGrid (from Codeplex). It is starting to have many different styles: one for switching it on and off based on a variable in the ViewModel one for visual styling one for some other triggers, etc. Do all of these need to be in one big style, is that the only way to do it? Or can I have multiple styles and attach th...

Using different CSS sheets with the same rule names for different HTML document elements

I need a way to load multiple style sheets with the same rule names, and then apply them to different elements on a page. Is this possible? Here's an example of something I'd like to do. Take the two style sheets below: style1.css: .size{ color: #FF6600; font-size: 18px; } style2.css: .size{ color: #FF0000; font-size: 14px; } ...