styles

Custom button template in WPF

早过忘川 提交于 2019-12-17 08:53:51
问题 I want to create a simple button template with an image and text inside it. But I want to keep the System button's look and feel. How do I create it, step by step? P.S.: I have already tried it with CustomControl in WPF and BasedOn property. 回答1: You can do this easily with a style and attached property: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ap="clr-namespace:MyProject.Namespace.Path

Android different EditText backgrounds for different states using shapes, selector or list

不想你离开。 提交于 2019-12-17 07:48:27
问题 I'm starting a new app where I use ActionBarSherlock & HoloEverywhereLib. My min & target SDK are the same (10/2.3.3). This is just so I can also quickly port it to Amazon Kindle & BB10 using the android runtime they have (already used this setup for another app and it worked without issue). All the while the app should have as close to ICS/JB look as possible. For my EditTexts though, I'm giving them a Girgerbread/iOS (round corners, but no shadows) look to them Someone mentioned to me a few

WrapPanel as ItemPanel for ItemsControl

烂漫一生 提交于 2019-12-17 07:24:54
问题 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 items wouldn't wrap because they effectively weren't inside the WrapPanel unless I put it as ItemsHost. Like this: <Style x:Key="ButtonPanelGroup" TargetType="{x

WPF window style not being applied

我与影子孤独终老i 提交于 2019-12-17 06:52:23
问题 I have a ResourceDictionary that contains Style definitions for controls used within my application. All of the styles are applied properly to the controls in the window...but the style in the ResourceDictionary for the window itself is not being applied. This is the XAML in my ResourceDictionary that contains the style that I want to apply to my window: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:primatives="clr-namespace:System.Windows

WPF window style not being applied

眉间皱痕 提交于 2019-12-17 06:52:11
问题 I have a ResourceDictionary that contains Style definitions for controls used within my application. All of the styles are applied properly to the controls in the window...but the style in the ResourceDictionary for the window itself is not being applied. This is the XAML in my ResourceDictionary that contains the style that I want to apply to my window: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:primatives="clr-namespace:System.Windows

XAML Combine Styles

…衆ロ難τιáo~ 提交于 2019-12-17 06:29:11
问题 Is there any way to combine mutliple styles in XAML to make a new style that has all of the desired settings? For example (pseudo code); <Style x:key="A"> ... </Style> <Style x:key="B"> ... </Style> <Style x:key="Combined"> <IncludeStyle Name="A"/> <IncludeStyle Name="B"/> ... other properties. </Style> I know that there is a 'BasedOn' property for styles, but that feature will only take you so far. I am really just looking for an easy way (in XAML) to create these 'combined' styles. But like

Why can't I style a DataGridTextColumn?

孤人 提交于 2019-12-17 06:12:28
问题 I tried to create a Style for DataGridTextColumn with the following code <Style TargetType="{x:Type DataGridTextColumn}"> ... </Style> However, Visual Studio 2010 highlights {x:Type DataGridTextColumn} with a blue line and elaborates: Exception has been thrown by the target of an invocation. Why does this happen and how do I fix it? 回答1: You can't style the DataGridTextColumn because DataGridTextColumn does not derive from FrameworkElement (or FrameworkContentElement ). Only FrameworkElement,

Why can't I style a DataGridTextColumn?

元气小坏坏 提交于 2019-12-17 06:12:22
问题 I tried to create a Style for DataGridTextColumn with the following code <Style TargetType="{x:Type DataGridTextColumn}"> ... </Style> However, Visual Studio 2010 highlights {x:Type DataGridTextColumn} with a blue line and elaborates: Exception has been thrown by the target of an invocation. Why does this happen and how do I fix it? 回答1: You can't style the DataGridTextColumn because DataGridTextColumn does not derive from FrameworkElement (or FrameworkContentElement ). Only FrameworkElement,

Cross-browser (IE8-) getComputedStyle with Javascript?

核能气质少年 提交于 2019-12-17 06:09:07
问题 Since IE8 does not support getComputedStyle , we can only use currentStyle . However, it does not return the real "computed" value for some properties. For example: <style type="text/css"> #div {/* no properties are defined here */} </style> <div id="div">div</div> // returns "medium" instead of 0px document.getElementById('div').currentStyle.borderLeftWidth // returns "auto" instead of 0px document.getElementById('div').currentStyle.marginLeft // returns "undefined" instead of 1 document

Change background color for selected ListBox item

≡放荡痞女 提交于 2019-12-17 02:43:13
问题 This is my XAML so far. <ScrollViewer Grid.Column="1" Grid.RowSpan="2"> <ListBox Background="Black" ItemsSource="{Binding Path=ActiveLog}" > <ListBox.ItemTemplate> <DataTemplate> <Grid Background="Black"> <Grid.ColumnDefinitions> <ColumnDefinition Width="200"></ColumnDefinition> <ColumnDefinition Width="*"></ColumnDefinition> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition></RowDefinition> <RowDefinition></RowDefinition> </Grid.RowDefinitions> <TextBlock Grid.Column="0" Grid