binding

RadioButton, Binding, Converters

自闭症网瘾萝莉.ら 提交于 2019-12-25 01:44:13
问题 I am working on Visual Studio 2008, and I have a problem with radiobuttons. I have 3 radioButton : <Window.Resources> // [...] <DataTemplate x:Key="gridViewReadyTemplate"> <StackPanel> <RadioButton GroupName="{Binding IdCommand}" IsChecked="{Binding CommandState, Mode=TwoWay, Converter={StaticResource enumBooleanConverter}, ConverterParameter=ready}" /> </StackPanel> </DataTemplate> <DataTemplate x:Key="gridViewReportedTemplate"> <StackPanel> <RadioButton GroupName="{Binding IdCommand}"

Bind property of root to value of child element in XAML

做~自己de王妃 提交于 2019-12-25 01:28:39
问题 I'm not too used to WPF, so this is probably something easy, but I've been struggling with it for a couple hours and can't seem to get how to properly do it. Say I have a BaseUserControl descending from UserControl with a dependency property Text . Then in XAML I'm creating a BaseUserControl descendant. I want that property Text to be bound to a control defined in that descendant. Say: <base:BaseUserControl ... all namespaces ... xmlns:base="clr-namespace:MyControlsBase" x:Class="Test

java static binding and polymorphism

怎甘沉沦 提交于 2019-12-25 01:27:03
问题 I am confused with the static binding example below. I reckon that S2.x and S2.y shows static binding as they prints out the fields according to s2 's static type. And S2.foo() makes s2 call the foo method in the super class, as foo is not over ridden in the subclass. However with S2.goo() , isn't it supposed to call the goo() method in the Test1 subclass? Like it's polymorphism? How come it's static binding? It looks like S2.goo() calls the Super Class goo() method and prints out =13 . Many

Menu and submenus using binding with Icon

邮差的信 提交于 2019-12-25 00:46:11
问题 I using this solution in order to bind my Menu just like at this example and I wonder how can I add icon to my MenuItem . In my Model I also have property called IsSelected so I try this approach: <Menu.ItemTemplate> <HierarchicalDataTemplate DataType="{x:Type Menu:MenuItemViewModel}" ItemsSource="{Binding Path=MenuItems}"> <StackPanel Orientation="Horizontal"> <Image Source="pack://application:,,,/Resources/checked_lightslategray.ico" Width="12" Height="12" Margin="0,0,0,0"> <Image.Style>

How do I bind to the parent's DataContext in a HierarchicalDataTemplate

南楼画角 提交于 2019-12-25 00:42:47
问题 I have a situation in which I am using a HierarchicalDataTemplate in which most display fields are bound to the items represented in this template (like you'd expect), but I also need one Binding to the data context of the UserControl itself. I fail to manage this last bit. So I currently have: <UserControl x:Class="MyProject.ProjectTreeView"> <UserControl.Resources> <HierarchicalDataTemplate DataType="{x:Type StreetViewModel}" ItemsSource="{Binding Houses}"> <!-- This Binding works fine

Bind custom control property with ListBox.Items

守給你的承諾、 提交于 2019-12-25 00:17:34
问题 My custom control has the following basic structure: public class NewTextBox : TextBox { public ItemCollection Items { get; set; } } And in XAML I have: <ListBox Name="listBox1" /> <my:NewTextBox Items="{Binding Path=listBox1.Items}" /> The bind doesn't work in this case. Is the property Items wrong? 回答1: Your binding is incorrectly. Use the ElementName property in your binding to tell WPF where to look for the data, then bind to the Items property <my:NewTextBox Items="{Binding ElementName

Multiple bindings to show dynamic content

本小妞迷上赌 提交于 2019-12-24 21:45:11
问题 When creating layout with dynamic content I often do something like: <Grid Visibility="{Binding IsLastSelectedItem, Converter=...}" > <Grid Visibility="{Binding IsStatisticAvailable, Converter=...}" > <TextBlock Visibility="{Binding HasStatistic, Converter=...}" Text="{Binding Statistic}" /> </Grid> </Grid> Here 2 containers are is used only to show something based on multiple conditions, it's 3 bindings combined with logical AND . Using MVVM it is possible to create single property and bind

How do I bind to a custom silverlight control?

岁酱吖の 提交于 2019-12-24 21:12:09
问题 I am having problems binding to my control. I would like the label(lblLabel) in my control to display the metadata from whatever is bound to the Field Property. It currently displays "Field" as a label. How do I get it to display "Customer Name :" which is the Name on the view model for property, CustomerName? My Controls XAML <UserControl x:Name="ctlRowItem" x:Class="ApplicationShell.Controls.RowItem" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas

jQuery event delegation for select/options in Chrome

為{幸葍}努か 提交于 2019-12-24 20:57:54
问题 I am trying to bind a simple click event to an the selected option of a pulldown. $('select#myselect').delegate(':selected', 'click', function() { alert('selected'); }); This code works in Firefox, but not Chrome/Safari. Can I use the .delegate() to bind an option for a pulldown menu like this? If so, how? If not, what is the best alternate solution? btw, jQuery Click on Event.. gives a potential solution using .change(), but I would like to manage all bindings with .delegate() if possible.

Binding to Entity Framework

喜欢而已 提交于 2019-12-24 20:41:40
问题 In the msdn documentation there is a recommendation to not bind controls directly to an object query: We recommend that you not bind controls directly to an ObjectQuery. Instead, bind controls to the result of the Execute method. I've also read some answers here on SO that recommend it and also not to bind to instance of the model itself. Nevertheless I couldn't find why it is not recommended since all of the tests I have done so far seem to work fine. Could anyone shed some light on the