Hi I am a novice in ZK and I would like to change the selected cell of a combobox from light blue, the standard colour, to green. I have been looking for online resources but somehow I couldn't fine anything. Any tips? Thanks in advance!
I think this is exactly what you are looking for i.e. selected item in the dropdown should be green instead of default light blue
<zk>
<style>
.z-combobox-rounded-pp .z-comboitem-seld, .z-combobox-pp .z-comboitem-seld {
background: green;
}
</style>
<window border="normal" title="hello">
<combobox>
<comboitem label="item 1"/>
<comboitem label="item 2"/>
<comboitem label="item 3"/>
<comboitem label="item 4"/>
</combobox>
</window>
</zk>
You can see a live demo of this here (with 6.0.1 breeze theme) but same code should work with ZK 6.5.1 freshly as well
Changing colors in ZK is done by apply/override css to the element.
The css class your looking for is .z-comboitem:hover.
Just add the following to the .zul
<style>
.z-comboitem:hover {
background: /* your color here*/;
}
</style>
Pleas read this for more information.
EDIT
Sorry my answer is for changing the the hover color not the selected and the first version I refered to the wrong CSS class...
#kachhalimbus answer should be the best, especially because he has for sure much more experience than me. So thanks to #kachhalimbu :)
Related
When I create (try to create) a ComboBox in WiX, the box receives its initial value from the corresponding property's value set earlier in the .wxs-file. This far, everythings goes as planned. When I try to change its value graphically, it displays no available list items. I have not found any necessary or relevant attributes etc in the docs that I haven't used, but also I'm quite noobish on WiX so maybe have missed something obvious. The code is below:
<Property Id="LANGUAGE" Value="Swedish" />
... cut ...
<Control Type="ComboBox" ComboList="yes" Property="LANGUAGE" Id="languages_combo" Width="..." Height="..." X="..." Y="...">
<ComboBox Property="LANGUAGE">
<ListItem Value="Swedish" />
<ListItem Value="English" />
</ComboBox>
</Control>
I want to be able to select "English" instead of "Swedish" in the drop-down, but that option is not available (and not "Swedish" for that matter - even that's the default value). Any suggestions how to solve this? I have searched the net without success, so I guess it's so basic no one has run into the same problem :-)
If it helps, here is the compilation:
candle test.wxs
light -ext WixUIExtension -sice:ICE20 test.wixobj
Attempts made by me:
Adding Text="..." to the ListItems does not help.
Replacing "ComboBox" with "ListBox" (and removeing attribute ComboList) displays the options/ListItems, but unfortunately ListBox is not the control that I want.
It's interesting when you make the same mistake over and over again, and never realize it's the good old mistake. I increased the Height attribute for Control, so the ListItems fit. Works like a charm!
I think you need to set the visible displayed text on the ListItems.
Try this:
<ComboBox Property="LANGUAGE">
<ListItem Text="English" Value="English" />
<ListItem Text="Swedish" Value="Swedish" />
</ComboBox>
I have an Image control on my WPF Window and I'd like to display a complex tooltip when the mouse is hovering over this Image.
Imagine like a spell icon in World of Warcraft, you mouse over and the spells tooltip is shown.
How can I do this in XAML?
You can achieve it like this:
<Image>
<Image.ToolTip>
<ToolTip.Content>
<!--...content goes here. -->
</ToolTip.Content>
</Image.ToolTip>
</Image>
You just put whatever you want into the ToolTip property in XML element syntax.
I recommend doing the following to what x0r stated:
<Image ToolTipService.ShowDuration="1440000">
<Image.ToolTip>
<ToolTip.Content>
<!--...content goes here. -->
</ToolTip.Content>
</Image.ToolTip>
</Image>
This leaves the tooltip open for 24 hours (yes, it's a long time). This is just a way to override that annoying 5-second rule.
In a WPF window I got a CheckBox containing an image, like this:
<CheckBox>
<Image Source="/Bsoft.Clients.Warenwirtschaft;component/Resources/MyImage.png" />
</CheckBox>
Using this, the checkmark is displayed left to the image.
Is there an easy way to move the checkmark to below the image?
I do not know of an easy way to do this.
You could either use some panel and have a checkbox independent from your image...
<StackPanel>
<Image .../>
<CheckBox .../>
</StackPanel>
Which might not be too much trouble if encapsulated in a UserControl.
Or you change the ControlTemplate of the CheckBox, which is more difficult i think. Default templates can be found on MSDN.
I made my own overlay... worked great... but then I noticed that it was appearing off the screen (cut off).
I know silverlight has a tooltip control that auto positions itself on the screen instead of letting itself be cut off.
how can I tap into this control? or is there a better way?
<TextBlock>
<ToolTipService.ToolTip>
<ToolTip>
<Overlay /> // This is you overlay
</ToolTip>
</ToolTipService.ToolTip>
</TextBlock>
You can put any content where <Overlay /> is. You can also apply this to any control, I just used a TextBlock for my example.
I'd like to make some custom MenuHeaders in WPF so I can have (for example), an icon and text in a menu item.
Normally using MenuItems, if you populate the Header field with straight text, you can add an accelerator by using an underscore. eg, _File
However, if I wanted to put in a UserControl, I believe this function would break, how would I do something similar to the following?
<Menu>
<MenuItem>
<MenuItem.Header>
<UserControl>
<Image Source="..." />
<Label Text="_Open" />
</UserControl>
</MenuItem.Header>
</MenuItem>
...
I think the Icon property fits your needs.
However to answer the original question, it is possible to retain the Accelerator functionality when you compose the content of your menuitem. If you have nested content in a MenuItem you need to define the AccessText property explicitly like in the first one below. When you use the inline form, this is automagically taken care of.
<Menu>
<MenuItem>
<MenuItem.Header>
<StackPanel Orientation="Horizontal">
<Image Source="Images/Open.ico" />
<AccessText>_Open..</AccessText>
</StackPanel>
</MenuItem.Header>
</MenuItem>
<MenuItem Header="_Close" />
</Menu>
The problem is you placed the image inside of the content of the MenuHeader which means that you'll lose the accelerator key. If you're just trying to have an image in the menu header, do the following.
<MenuItem Header="_Open">
<MenuItem.Icon>
<Image Source="images/Open.png"/>
</MenuItem.Icon>
</MenuItem>
If you want to customize the look and feel even further, modify the controltemplate and style for the menu. From experience, styling the menus and menuitems are much more difficult then styling the other WPF controls.
First thought, you would think that the Icon property can only contain an image. But it can actually contain anything! I discovered this by accident when I programmatically tried to set the Image property directly to a string with the path to an image. The result was that it did not show the image, but the actual text of the path! Then I discovered that I had to create an Image element first and set that to the Icon property. This lead me to think that the Image property was just any content container that is located in the icon area at the left in the menu, and I was right. I tried to put a button there, and it worked!
This is showing a button with the text "i" in the Icon area of the menu item. When you click on the button, the Button_Click event is triggered (the LanguageMenu_Click is NOT triggered when you click the button).
<MenuItem Name="LanguageMenu" Header="_Language" Click="LanguageMenu_Click">
<MenuItem.Icon>
<Button Click="Button_Click">i</Button>
</MenuItem.Icon>
</MenuItem>
This leads to an alternative to not have to make an image for the icon, but use text with a symbol font instead to display a simple "icon". The following example uses the Wingdings font which contains a floppydisk symbol. This symbol in the font is mapped to the charachter <, which has special meaning in XAML, so we have to use the encoded version < instead. This works like a dream! The following shows a floppydisk symbol as an icon on the menu item:
<MenuItem Name="mnuFileSave" Header="Save" Command="ApplicationCommands.Save">
<MenuItem.Icon>
<Label VerticalAlignment="Center" HorizontalAlignment="Center"
FontFamily="Wingdings"><</Label>
</MenuItem.Icon>
</MenuItem>
#a7an: Ah, I didn't notice the Icon property before. That's a good start.
However, specifically I wanted to add an extra 'button' to some MenuItems so I could have a 'Pin' feature (see the recently loaded Documents list in Office 2007 for the feature idea).
Since there needs to be code as well, will I probably need to subclass the control and add the code for the button? (Not affraid of messing with the MenuItem template, have already had to do it once and I'd do it again if I had to! ;) )