binding

Get Selected Radio Button in a Group (WPF)

久未见 提交于 2019-12-21 04:02:51
问题 I have a ItemsControl in my program that contains a list of radio buttons. <ItemsControl ItemsSource="{Binding Insertions}"> <ItemsControl.ItemTemplate> <DataTemplate> <Grid> <RadioButton GroupName="Insertions"/> </Grid> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> How do I find the selected radio button in the group Insertions in a MVVM manner? Most of the examples I have found on the internet involve setting individual boolean properties that you bind the IsChecked property

Enable a TabItem via Binding

核能气质少年 提交于 2019-12-21 03:55:10
问题 I want to use MVVM in an application where the different pages are TabItems. For this I use an observable collection of my view models (Items) and bind it to the tabcontrols ItemSource. For each view model, I created an individual data template to render the correct view like this: <DataTemplate DataType="{x:Type baseVm:AViewModel}"> <baseVw:AView /> </DataTemplate> To display the correct name in the tab's header I created another data template to be applied to each of the tab control's

WPF Databinding and cascading Converters?

牧云@^-^@ 提交于 2019-12-21 03:53:10
问题 i wonder if it is possible to cascade converters when using wpf databinding. e.g. something like <SomeControl Visibility="{Binding Path=SomeProperty, Converter={StaticResource firstConverter}, Converter={StaticResource secondConverter}}"/> is it possible at all or do i have to create a custom converter that combines the functionality of converter A and B? 回答1: You could try to use a MultiBinding , and bind twice to the same source, but with different converts on the single bindings. Something

WPF Databinding and cascading Converters?

↘锁芯ラ 提交于 2019-12-21 03:53:08
问题 i wonder if it is possible to cascade converters when using wpf databinding. e.g. something like <SomeControl Visibility="{Binding Path=SomeProperty, Converter={StaticResource firstConverter}, Converter={StaticResource secondConverter}}"/> is it possible at all or do i have to create a custom converter that combines the functionality of converter A and B? 回答1: You could try to use a MultiBinding , and bind twice to the same source, but with different converts on the single bindings. Something

Availability of UI elements in Marionette.View

佐手、 提交于 2019-12-21 03:50:47
问题 I'd just like to understand the decisions behind Backbone.Marionette's view regarding UI elements. When instantiating a Marionette.View on an existing DOM element, like this: view = new Marionette.ItemView({ el: "#element", ui : { whatever : "#whatever" } }); I am able to access view.$el , the jquery selector inside view.initialize , so far so good. However, when I try to access view.ui.whatever , I only have access to the selector, ie the string "#whatever" instead of the actual $("#whatever

WPF Binding to Tooltip

喜夏-厌秋 提交于 2019-12-21 03:49:12
问题 Not sure whats doing here, but the binding works for the label in the data template but not the tool tip. Any help will be appreciated. <DataTemplate DataType="Label"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> <StackPanel.ToolTip> <ToolTip DataContext="{Binding Path=PlacementTarget, RelativeSource={x:Static RelativeSource.Self}}"> <TextBlock Text="{Binding Path=DataContext.Description}" /> </ToolTip> </StackPanel.ToolTip> <Image Source="{StaticResource ApplicationInfoS}

Getting selected item in ItemsControl

南笙酒味 提交于 2019-12-21 03:47:20
问题 I have the following code which populates my user control in form of rows and column. The user control which is being populated contains Button, links, textbox etc. When a certain button is pressed on a particular User Control in a particular row/column, I need to know for which User Control that button was pressed. Here is the XAML that is populating the user controls in rows and columns <ItemsControl ItemsSource="{Binding Templates}" Width="{Binding GridWidth}"> <ItemsControl.ItemsPanel>

WPF TextBox binding to decimal respecting culture

青春壹個敷衍的年華 提交于 2019-12-21 03:42:33
问题 I've bound a TextBox to a Decimal. My problem ist, the Binding is using american numerical standards, using a dot for decimals separation ("1.5") My system is german and configured to use a comma as decimals separation ("1,5"). I need the TextBox binding to show and use a comma instead of a dot to separate decimals. How do I get the binding to respect the currently set localization/culture settings for numerical input? 回答1: Read this article. You should set default language for all framework

What does event binding mean?

北慕城南 提交于 2019-12-21 03:32:26
问题 What does event binding mean? I always come across this word whenever I search around the internet and whatever I try to look for the meaning, it's still vague to me @_@ A while ago, while reading some blogs regarding JavaScript I see people using this sacred word that I cannot grasp. 回答1: Event binding refers to telling the browser that a particular function should be called whenever some 'event' occurs. Events mostly relate to user input, such as clicks. An example of binding to an event in

Is there a way to refresh all bindings in WPF?

╄→尐↘猪︶ㄣ 提交于 2019-12-21 03:21:18
问题 If my code looks somewhat like the code beneath, would it be possible to refresh all bindings directly or would I have to hard-code all the bindings to refresh? Service-side: [ServiceContract] public interface IMyServiceContract { [OperationContract] MyDataContract GetData(); } [ServiceBehavior] public class MyService { [OperationBehavior] public MyDataContract GetData() { MyDataContract data = new MyDataContract(); data.val1 = "123"; data.val2 = "456"; return data; } } [DataContract] public