styles

Need multiple styles dependent on Listboxitem

走远了吗. 提交于 2019-12-25 02:43:31
问题 i have a Listbox, which stores two different object types, based on the same baseclass. (e.g. BaseObject = baseclass and the children of it: CustomPath and CustomImage) The Datasource: ObservableCollection<BattlegroundBaseObject> _baseObjectCollection; public ObservableCollection<BattlegroundBaseObject> BaseObjectCollection { get { return _baseObjectCollection?? (_baseObjectCollection= new ObservableCollection<BaseObject>()); } } The Listbox databinding: <ListBox ItemsSource="{Binding

Hover over label change rectangle background gradient

。_饼干妹妹 提交于 2019-12-25 02:04:12
问题 I have a rectange with several labels and images over it, and I have it so that when the user hovers their mouse over the rectangle the background changes to a gradient: <Rectangle Height="88" HorizontalAlignment="Left" Margin="54,28,0,0" Name="rectangle2" VerticalAlignment="Top" Width="327" Cursor="Hand"> <Rectangle.Style> <Style TargetType="{x:Type Rectangle}"> <Setter Property="Fill" Value="Transparent" /> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property=

Binding the Trigger value dynamic in WPF

有些话、适合烂在心里 提交于 2019-12-25 01:49:26
问题 I'm using ListView along with the GridView for displaying the data in tabular format: <ListView> <ListView.View> <GridView> <GridViewColumn Header="Name" Width="120" DisplayMemberBinding="{Binding Name}" /> <GridViewColumn Header="Risk" Width="150" DisplayMemberBinding="{Binding RiskName}" /> </GridView> </ListView.View> I have to change the background color based on the RiskName . For example, if RiskName is "High" then the background would be Red, if RiskName is "Medium" then the background

How to bind property to style of the rectangle in a UserControl in WPF

只愿长相守 提交于 2019-12-25 01:06:43
问题 I have a rectangle with a style definded in < Rectangle.Style> but the data binding within the style is not working? How to fix the problem? if I override the rectangle, it works (but the animation does not work). but if I moved it to the style it does not work any more. <UserControl x:Class="MyProject.WPF.Controls.UI_MovingLine" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org

CSS: @media print without external css file?

不打扰是莪最后的温柔 提交于 2019-12-25 00:58:07
问题 I want to print a html page in a specific way under css. But all the @media print examples seem to have an external .css file I want to be able to do it without an external file which means there will be no link rel tag: <LINK REL="stylesheet" MEDIA="print... How do I do this? 回答1: I would suggest using an external stylesheet but you can how ever do this on the same page as your HTML if you really want to, an example of this would be like so, HTML / CSS <!DOCTYPE html> <html> <head> <style>

How to override ContextMenu in global style?

我只是一个虾纸丫 提交于 2019-12-24 23:52:06
问题 I declare the style of my control in library: <ContentControl.Resources> <ContextMenu x:Key="ContextMenu"> <MenuItem Header="{x:Static Drawing:Headers.AddEdge}" Click="AddEdgeClick"/> <MenuItem Header="{x:Static Drawing:Headers.ChangeID}" Click="ChangeIDClick"/> <MenuItem Header="{x:Static Drawing:Headers.Remove}" Click="RemoveClick"/> </ContextMenu> <Style x:Key="Style" TargetType="{x:Type Drawing:Node}"> <Setter Property="ContextMenu" Value="{StaticResource ContextMenu}"/> </Style> <

Is it possible to “remove” styling from HTML elements?

荒凉一梦 提交于 2019-12-24 19:24:15
问题 I'm wondering if it's possible to restore an element's style to it's "default" state, with Javascript or otherwise. I need to do this because I'm inserting HTML into 3rd party web pages and cannot control what styles they attribute to different elements. For instance, they may have: div { margin: 10px; padding: 5px; line-height: 10px; font-size: 150%; border: 10px solid yellow; foo: bar; } Is there an easy way to clear out all of the styles and set it back to the "default" settings? Is there

How to manage styles for child components?

懵懂的女人 提交于 2019-12-24 15:04:13
问题 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 component, and I want to have some style values "jump" the parent component and only affect a specific child (not all of them). I would like to have a single CSS

WPF combobox disabled background color

跟風遠走 提交于 2019-12-24 13:30:47
问题 It seems like the background color for a WPF combobox is not overrideable when IsEnabled is set to False. Setting the Foreground property does work correctly. Even using snoop and setting the background does not change the combobox background color in the disabled state. Here is the style I'm using (based on Blend's template copy). Any Ideas? <!-- COMBO BOX--> <Style x:Key="ComboBoxFocusVisual"> <Setter Property="Control.Template"> <Setter.Value> <ControlTemplate> <Rectangle Margin="4,4,21,4"

PHP navigation menu and active page styling

荒凉一梦 提交于 2019-12-24 13:26:00
问题 Hi I'm trying to generate my websites navigation/page buttons and give the active page a style element. What I have at the moment is applying the style element to the home page but when navigating to other pages the style element stays on the 'Home' button rather than applying itself to the current page. My pages are dynamic with the url being like so: http://www.website.com/?p=contact <?php $current = array( "" => "Home", "?p=contact" => "Contact Us", "?p=about" => "About Us", "?p=privacy" =