binding

Not able to bind click event to newly created span items (jQuery)

≡放荡痞女 提交于 2019-12-22 01:18:25
问题 I'm not able to bind events to a list that is generated by jQuery. I've looked at some similar issues, but havent found any solution. This is the code that generates my list: var list = '<ul>'; for (var i = 0; i < data.length; i++) { list += '<li id="' + data[i].id + '"><span class="btnRemoveItem" title="Remove item from list"></span>' + data[i].name + '</li>'; } list += '</ul>'; jQuery("#spanContainer").html(list); This creates my wanted list. Works great. But I'm not able to manipulate the

Binding UserControl unload event to ViewModel

…衆ロ難τιáo~ 提交于 2019-12-22 01:17:39
问题 I'm reasonable new to MVVM and have a usercontrol as my View. I'd like to Bind the "unload" event of that control to a method in my ViewModel. To clean up stuff when the control is shutting down. My search so far has only come up with xamples that require you to include some kind of toolkit or libraries from expression blend SDK. I just want to use he generic .net 4.1 libraries. Can some one show me how to accomplish this ? 回答1: I've always used the code shown here to create an

How to bind the same collection of values into all ComboBoxes in a DataGridComboBox?

▼魔方 西西 提交于 2019-12-21 23:39:03
问题 I have a Collection of Values in an Array of Strings, or in a List or whatever, and what i want is to set this Collection of values as the Collection of items into all the ComboBoxes in a column as DataGridComboBoxColumn in WPF. I think i don't have other way to access this Collection of Values and bind it equally to all the ComboBoxes (in XAML) beside the DataContext. But can i access the DataContext of a DataGrid from a DatGridComboBoxColumn (in XAML)? Can i do it? How? How i specify (in

Manual binding in Cocoa

巧了我就是萌 提交于 2019-12-21 21:39:34
问题 I have an ImageView which shows a lock, informing if an opened file is locked or not. I have 2 images for locked and unlocked cases. I want synchronize the displayed image with boolean value of my object representing an opened file. To do this I want my ViewController to change the image in my ImageView depending on lock state of object. So both object and ViewController have a property "isLocked". How can I synchronize them? It is easy in IB but I don't know how to do it programmatically. I

How can I bind inside this ControlTemplate?

淺唱寂寞╮ 提交于 2019-12-21 21:36:16
问题 I have a ListView , filled with a List<MyListItem> and I need to use a ControlTemplate to be able to change the effects when an item is selected. Now I have the problem that {Binding MyProperty} doesn't work inside of that ControlTemplate . How can I access the properties of MyListItem inside the template? My XAML looks like this(simplified): <ListView Name="ListView" Grid.Column="1" IsSwipeEnabled="False"> <ListView.ItemContainerStyle> <Style TargetType="ListViewItem"> <Setter Property=

Binding to multiple indexers

偶尔善良 提交于 2019-12-21 21:24:33
问题 I am trying to bind an indexed property with two indexers. The property looks like this public Item this[int x, int y] { get { return _items[x, y]; } set { _items[x, y] = value; } } According to http://msdn.microsoft.com/en-us/library/ms742451.aspx, it is possible to bind against indexed properties like that <object Path="propertyName[index,index2...]" .../> There is even an example: <Rectangle Fill="{Binding ColorGrid[20,30].SolidColorBrushResult}" .../> However when I try to access that

WPF xml:lang/Language binding

女生的网名这么多〃 提交于 2019-12-21 20:56:58
问题 how can i bind Listbox's or texblock's Language attribute (or xml:lang attribute). i want to show month names in the specific language setting ex: <TextBlock x:Name="Date" xml:lang="{Binding Lang}"> <TextBlock.Text> <MultiBinding StringFormat=" {0:dd.MMM.yyyy}-{1:dd.MMM.yyyy}"> <Binding Path="Date1"/> <Binding Path="Date2"/> </MultiBinding> </TextBlock.Text> result should be according to Lang property: 01.Apr.2011 - 01.Apr.2011 en-US or 01.Nis.2011 - 02.Nis.2011 tr-TR or .... it gives

WPF Hide DataGridColumn via a binding

不打扰是莪最后的温柔 提交于 2019-12-21 20:29:10
问题 For some reason I can't hide WPF Toolkit's DataGridColumn. I am trying to do the following: <dg:DataGridTemplateColumn Header="Item Description" Visibility="{Binding IsReadOnly}"> <dg:DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBox Text="{Binding Path=ItemDescription}" /> </DataTemplate> </dg:DataGridTemplateColumn.CellTemplate> This doesn't work, since it's looking for a IsReadOnly property on the ItemSource (not a property of the current class). If add this as a property of the

Contentpresenter with type based datatemplate selection and binding

别来无恙 提交于 2019-12-21 19:28:11
问题 I have an ItemsControl that binds to a list of items. These items have a name and value property. The value property is of type Object to allow different datatypes to be used. To display the value property correctly I use a ContentPresenter with a datatemplate for every datatype I might use. <ItemsControl ItemsSource="{Binding Items}"> <ItemsControl.ItemTemplate> <DataTemplate> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> <ColumnDefinition Width="Auto" /> <ColumnDefinition

Best practice using BIND or ON functions in jQuery [duplicate]

帅比萌擦擦* 提交于 2019-12-21 17:58:09
问题 This question already has answers here : What's the difference between `on` and `live` or `bind`? (7 answers) Closed 6 years ago . Recently the jQuery team start recommending to use on instead of bind for binding events to the DOM. I would like to know if there is a difference between them, what is the benefit of using the on function and if it would be a good call of changing all my bind 's to on 's functions in my code? 回答1: The jQuery project is moving towards putting more and more