styles

ListBoxItem style in <ListBox.Resources> or in <ListBox.ItemContainerStyle>?

倖福魔咒の 提交于 2020-01-02 04:47:07
问题 I can put a xaml Style for ListBoxItem in <ListBox.Resources> or in <ListBox.ItemContainerStyle> . See code. Question is: what is the difference, what should I prefer? <ListBox.Resources> <Style TargetType="ListBoxItem"> <Setter Property="Canvas.Top" Value="{Binding Top}"/> <Setter Property="Canvas.Left" Value="{Binding Left}"/> <Setter Property="VerticalContentAlignment" Value="Stretch"/> <Setter Property="HorizontalContentAlignment" Value="Stretch"/> <Setter Property="Padding" Value="0"/> <

WPF TextBlock Negative Number In Red

我的梦境 提交于 2020-01-02 02:42:08
问题 I am trying to figure out the best way to create a style/trigger to set foreground to Red, when value is < 0. what is the best way to do this? I'm assuming DataTrigger, but how can I check for negative value, do i have to create my own IValueConverter? 回答1: If you are not using an MVVM model (where you may have a ForegroundColor property), then the easiest thing to do is to create a new IValueConverter, binding your background to your value. In MyWindow.xaml: <Window ... xmlns:local="clr

Binding a WPF Style Trigger to a custom dependency property

删除回忆录丶 提交于 2020-01-02 01:47:08
问题 I have found numerous similar threads here, but none that seem to address my specific issue. I need to highlight the background of a textbox under certain conditions. I have created a Highlight property and tried using a trigger in a style to set it but it doesn't actually ever highlight the text. Here is my Style, simplified: <Style x:Key="TextBoxStyle" BasedOn="{StaticResource CommonStyles}"> <Style.Triggers> <Trigger Property="Elements:DataElement.Highlight" Value="True"> <Setter Property=

WPF CheckBox style with the TextWrapping

*爱你&永不变心* 提交于 2020-01-02 00:44:11
问题 I need to apply a TextWrapping in the WPF CheckBox . Please look at this two samples: <CheckBox> <TextBlock TextWrapping="Wrap" Text="_This is a long piece of text attached to a checkbox."/> </CheckBox> <CheckBox> <AccessText TextWrapping="Wrap" Text="_This is a long piece of text attached to a checkbox."/> </CheckBox> If I use a TextBlock in the Content of the CheckBox , the check element (vertical alignment is top) and the text displays properly, but not the accelerator. If I use an

Android 3.0: cannot style Action Bar 's action item buttons

為{幸葍}努か 提交于 2020-01-01 19:33:30
问题 Here is the dev guide related to the subject http://developer.android.com/guide/topics/ui/actionbar.html#ActionItems So we have in activity public class MyActivity extends Activity { @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.my_menu, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.first_menu_button:

Add a UserControl in/over titlebar in Window

十年热恋 提交于 2020-01-01 16:46:11
问题 In WPF, I want to add a userControl in/over titlebar in Window, like this: The Red part is that UserControl, and the Green part is titlebar. Now I hope to get some suggestions from you. Need to extend the Window class or just customize the style of the Window? It's better to provide source code. 回答1: You can do this by implementing your own title bar. In order to do so set your window style to none: WindowStyle="None" This will mean that the window will have no control box (minimize, maximize

how do you create tags like stackoverflow with text styling

╄→гoц情女王★ 提交于 2020-01-01 12:23:27
问题 I was wondering how you can create css styling inside an input field such as stackoverflow's tagging system? When you click on a tag, the text will be styled. And also, when you click on the styled tag, it will be normal again. I guess my main concern is how to style text inside an input field? Thanks! 回答1: This might help you: http://basdebie.com/jquery-plugins/jquery-tags-autosuggest-like-delicious-stackoverflow-facebook/ By looking at this code, you should be able to create something

angular2-cli gives @multi styles error

佐手、 提交于 2020-01-01 07:46:21
问题 I started using angular2-cli recently and created a new project. I wanted to use bootstrap in my project hence I installed bootstrap and then wanted to import the bootstrap css file like it is shown in the the angular2-cli guide here. https://github.com/angular/angular-cli#global-library-installation After running ng serve I get the following error. ERROR in multi styles Module not found: Error: Can't resolve '/home/krishna/angular2_migrate/webui/node_modules/bootstrap/dist/css/bootstrap.min

How to set background color based on bool property in WPF

烂漫一生 提交于 2020-01-01 07:30:05
问题 I want to set the backgroun color for a GridViewColumn that is databound inside of a listview in WPF. I'm not sure how to ask this question being fairly new to WPF, otherwise I wouldn't have bothered all of you. I want to change the background color of the whole row, based on a bool flag in my databound object. In this case, I have, well, a "CaseDetail" object, that when there are internal notes "IsInternalNote" I want the color of the row to change. How can I pull this off in WPF? What I

Shiny: Label position, textInput

夙愿已清 提交于 2020-01-01 07:01:10
问题 Lets assume I have a very simple application that only has 8 inputs grouped in 2 Panels (4 inputs | 4 inputs - see picture bellow) and based on these, I plot a small plot (easy peasy). The problem that I face is that I want to have the labels only for the first panel, and on the left of the textInput box. e.g. (Please excuse my sloppy image editing!) Any suggestion? My MWE for Figure 1 output: library(shiny) ui<-shinyUI(fluidPage( wellPanel( tags$style(type="text/css", '#leftPanel { max-width