styles

Setting toolbar button sizes using a Style

别等时光非礼了梦想. 提交于 2020-01-21 04:51:06
问题 I have buttons on a toolbar in WPF. When I do the XAML: <ToolBar.Resources> <Style TargetType="{x:Type Button}"> <Setter Property="Width" Value="21"></Setter> <Setter Property="Height" Value="21"></Setter> </Style> </ToolBar.Resources> None of the buttons on the toolbar set their sizes accordingly. I have to go to each button and manually set their widths and heights to the desired values. Any idea why the Style on the toolbar does not work? 回答1: This occurs because ToolBar applies the style

How do I make a marquee progress bar in WPF?

有些话、适合烂在心里 提交于 2020-01-20 18:18:25
问题 In Winforms I could set the ProgressBarStyle of a progress bar to Marqee, and that would have the progress bar incriment on its own without having to be set, for processes where I don't know how long its going to take, and no good way to report back to the UI. I would like to do the same in WPF, but I can't find a way to pull it off short of hosting a winform progress bar, which seems counter productive. How can I pull this off in WPF? Do I have to host a winform progress bar? 回答1: I think

Change WPF Button Foreground when the “IsMouseOver” is True

会有一股神秘感。 提交于 2020-01-17 06:06:24
问题 I have seen a few similar questions but not of the solutions seem to work. I would prefer to have the solution through XAML but wouldn't mind it through code (VB.net) either. I have this code currently, not sure how much of it is correct: <Style TargetType="{x:Type Button}"> <Setter Property="OverridesDefaultStyle" Value="True"/> <Setter Property="Foreground" Value="DarkSlateGray"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border Background=

Change WPF Button Foreground when the “IsMouseOver” is True

巧了我就是萌 提交于 2020-01-17 06:05:31
问题 I have seen a few similar questions but not of the solutions seem to work. I would prefer to have the solution through XAML but wouldn't mind it through code (VB.net) either. I have this code currently, not sure how much of it is correct: <Style TargetType="{x:Type Button}"> <Setter Property="OverridesDefaultStyle" Value="True"/> <Setter Property="Foreground" Value="DarkSlateGray"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border Background=

WPF Style can't work on multiple controls

末鹿安然 提交于 2020-01-16 13:15:10
问题 I am using wpf style on my controls so that i can use an style on multiple controls at once. It usually works. for example i made an saveButtonStyle and i apply it on every save button on my application. But it doesn't work on MenuItems. I made a style for my menuitems which contains an icon next to the items. This is one screen shot of it. You see the Datagrid has an ContextMenu and within it there is multiple menu items. in this case pay attention to Set Alarm. it has an icon. This Set

Java Change Color of Element on JTextPane using StyledDocument

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-16 06:04:09
问题 this is kinda overkill for me.. I am using a JTextPane for a chat, I have colors there.. What I want is, with reference to a element changing the color of it.. I am using StyledDocument, I have no clue how to do this.. Thanks in advance ;) 回答1: Use setCharacterAttributes(). Define desired color in a SimpleAttributeSet using StyleConstants.setBackground()/setForeground(). Use Element's start and end offsets for the offset and length. If the last attribute is false only thouse attributes of

change button style according to state angularjs

ε祈祈猫儿з 提交于 2020-01-15 08:29:09
问题 I have a problem finding the way to style a button according to it's state. I have a question, and four answer tiles. each tiles is coded like this: <div class="button-default" ng-model="btn0" ng-click"evalAnswer(answer, btn0)">{{answer}}</div> <div class="button-default" ng-model="btn1" ng-click"evalAnswer(answer, btn1)">{{answer}}</div> <div class="button-default" ng-model="btn2" ng-click"evalAnswer(answer, btn2)">{{answer}}</div> <div class="button-default" ng-model="btn3" ng-click

Change Horizontal Progress Bar Color

混江龙づ霸主 提交于 2020-01-15 02:54:11
问题 Problem Description I'm trying to change ProgressBar color using custom style defined in the style.xml layout.xml <ProgressBar android:id="@+id/progress_bar" style="@style/ProgressTheme" android:layout_width="wrap_content" android:layout_height="wrap_content" android:indeterminate="true" android:indeterminateBehavior="repeat" /> style.xml <style name="ProgressTheme" parent="Widget.AppCompat.ProgressBar.Horizontal"> <item name="colorAccent">#000</item> </style> Question I find some useful

WPF Setting style based on datatype?

a 夏天 提交于 2020-01-14 09:38:29
问题 Here's the problem. I'm binding a TreeView with a few different types of objects. Each object is a node, and SOME objects have a property called IsNodeExpanded, and of course, some others don't. Here's my style: <Style TargetType="{x:Type TreeViewItem}"> <Setter Property="IsExpanded" Value="{Binding IsNodeExpanded, Mode=TwoWay}" /> </Style> Now, the problem is when binding the items that DON'T have this property, we get this error in the output: System.Windows.Data Error: 39 :

How do I style the contents of a JQuery dialog box?

亡梦爱人 提交于 2020-01-14 03:53:32
问题 I'm trying to click a link & put that text into a jquery dialog WITH its original styling (not the dialog's style)? I'm using jquery to do an element selection by mouse (like Firebug), then once I click on the element I want to add it into a div inside a jquery dialog box. Everything works fine except the styling - I want the clicked element's style to be the same INSIDE the dialog box as it is on the third party page. I've used www.wsj.com as the example here, but it could be any site - when