binding

WPF Tooltip Visibility

岁酱吖の 提交于 2019-12-17 16:43:10
问题 How can I ensure that a button's Tooltip is only visible when the button is disabled? What can I bind the tooltip's visibility to? 回答1: You will need to set ToolTipService.ShowOnDisabled to True on the Button in order to have the Tooltip visible at all when the Button is disabled. You can bind ToolTipService.IsEnabled on the Button to enable and disable the Tooltip. 回答2: This is the full XAML of the Button (based on the answer of @Quartermeister) <Button x:Name="btnAdd" Content="Add"

How to do calculation in xaml while binding?

大憨熊 提交于 2019-12-17 16:33:40
问题 I can bind a label to a slider as shown below: <Label Name="lblTest" Content="{Binding ElementName=slider1, Path=Value}"/> How do I bind another label to the same slider with display value of, say, 30% of the value of slider? How do I do the calculation in xaml and not in my code? Thanks. 回答1: You cannot do the calculation in XAML, you could however apply some converter which does it for you. This question might be relevant: How do you change a bound value, reverse it, multiply it, subtract

Multiple activities binding to a service

自古美人都是妖i 提交于 2019-12-17 16:30:24
问题 I have a service component (common task for all my apps), which can be invoked by any of the apps. I am trying to access the service object from the all activities, I noticed that the one which created the service [startService(intent)] has the right informaion. But rest does not get the informaion needed. My Code is as below: // Activity.java public void onCreate(Bundle savedInstanceState) { ... Intent intent = new Intent (this.context, Service.class) ; this.context.startService(intent) ;

Attaching jQuery event handlers so that they are triggered first

拥有回忆 提交于 2019-12-17 15:46:44
问题 Is there a way to attach a jQuery event handler such that the handler is triggered before any previously-attached event handlers? I came across this article, but the code didn't work because event handlers are no-longer stored in an array, which is what his code expected. I attempted to create a jQuery extension to do what I wanted, but this is not working (the events still fire in the order they were bound): $.fn.extend({ bindFirst: function(type, handler) { var baseType = type; var dotIdx =

Double Click a ListBox item to open a browser

纵然是瞬间 提交于 2019-12-17 15:39:30
问题 I have a ListBox in my wpf window that binds to an ObervableCollection . I want to open the browser if someone clicks on an element of the ListBox (just like a link). Can someone tell me how to do this? I found something with listboxviews, does it only work this way or is there a way by just using the ListBox ? Yours Sebastian 回答1: You can add a style to ListBox.ItemContainerStyle, and add an EventSetter there: <ListBox> .... <ListBox.ItemContainerStyle> <Style TargetType="{x:Type ListBoxItem

Binding ContentControl Content for dynamic content

我与影子孤独终老i 提交于 2019-12-17 15:22:40
问题 I'm currently trying to achieve the functionality of a tabcontrol with hidden tabs by using a ListView (as tabs) and a ContentControl with Binding the Content Property. I read a bit on that topic and if I got it right, it should work this way: <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="20.0*"/> <ColumnDefinition Width="80.0*"/> </Grid.ColumnDefinitions> <ListBox Grid.Column="0"> <ListBoxItem Content="Appearance"/> </ListBox> <ContentControl Content="{Binding SettingsPage}" Grid

bind date to command object in Grails

痴心易碎 提交于 2019-12-17 14:46:46
问题 I have a date (as a string) being submitted. I'd like to map this to a command object. I have looked around quite a bit and found no great resource on how to do this mapping within a command object to a real date. If I were to do this in the controller itself I could just do the following, however this doesn't allow me to easily map into my command object. def endDate = params.date('endDate', 'MM/dd/yyyy') For my command object, the closest I've been able to get is to override the getter and

Binding Image.Source to String in WPF?

点点圈 提交于 2019-12-17 11:55:11
问题 I have below XAML code : <Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" DataContext="{Binding RelativeSource={RelativeSource Self}}" WindowStartupLocation="CenterScreen" Title="Window1" Height="300" Width="300"> <Grid> <Image x:Name="TestImage" Source="{Binding Path=ImageSource}" /> </Grid> </Window> Also, there is a method that makes an Image from a Base64 string : Image

Binding to a WPF ToggleButton's IsChecked state

情到浓时终转凉″ 提交于 2019-12-17 10:57:40
问题 I would like to use a WPF ToggleButton to expand and collapse some controls in my application. How can I use XAML to accomplish this? I'm thinking that I could somehow bind the Visibility attribute of some controls to the ToggleButton 's IsChecked state, but I do not know how to do this. Maybe I need to give my ToggleButton a Name , then bind using ElementName ? Then I would need a ValueConverter for converting between a boolean value and a Visibility, correct? How could I make a generic

Fancybox, getting Fancybox to bind using LIVE() to items being loaded onto the page after load

百般思念 提交于 2019-12-17 10:49:17
问题 I have a page that loads and after it loads, it pulls in a list of LIs to populate a news feed. <li><a href="/url/" class="quickview">quick view</a></li> <li><a href="/url/" class="quickview">quick view</a></li> <li><a href="/url/" class="quickview">quick view</a></li> I'm trying to get fancy box to trigger when a user clicks on quick view but haven't had any luck. Any Ideas? $(document).ready(function() { $('.quickview').fancybox(); }); also tried: $(document).ready(function() { $('a