isenabled

How to set IsReadOnly / IsEnabled on entire container like Panel or GroupBox using XAML?

夙愿已清 提交于 2019-12-07 10:29:11
问题 I have a MVVM application that contains multiple views with some complex IsReadOnly rules based on user permissions, view/edit mode and object state. I would like to set IsReadOnly and/or IsEnabled properties for entire groups of controls in the same container ( GroupBox / StackPanel / Grid / UserControl / etc.). The value of this property will be defined in ViewModel. I've got 3-6 different SomeGroupIsReadOnly properties per UserControl (with a large number of input controls like TextBox ,

WPF Button IsEnabled Based on ComboBox Selection Overwriting default style

喜欢而已 提交于 2019-12-07 04:35:27
问题 I have a Button that is looking at 2 comboboxes to make sure they have a value before it is enabled. The problem is the way I am doing it is overwriting the default style declared in my theme project. <Button x:Name="btnOK" VerticalAlignment="Center" Content="OK" IsDefault="True" Margin="0" Click="btnOK_Click"> <Button.Style> <Style BasedOn="{StaticResource DefaultButton}"> <Style.Triggers> <DataTrigger Binding="{Binding ElementName=ddlWageTypes, Path=SelectedItem}" Value="{x:Null}"> <Setter

How to bind a ComboBoxItem's IsEnabled property to the result of a Command's CanExecute method

China☆狼群 提交于 2019-12-06 04:22:36
I've a custom SplitButton implementation in which contains a ComboBox with several ComboBoxItems bound to commands. I can bind to the Name, and Text properties of the command just fine but have no way of binding the ComboBoxItem's IsEnabled property to the result of a Command's CanExecute method because it is a method. Is there some syntax that I'm unaware of for binding to methods or is there some trickery that will help me to bind to CanExecute. By the way, I've thought about using a custom ValueConverter except for that I realized that I probably wouldn't receive any updates when CanExecute

WPF element databinding for IsEnabled (but for false)

我是研究僧i 提交于 2019-12-06 03:26:23
问题 I'm a starter in WPF, and there's something I can't seem to figure out. I have a CheckBox that I would like to disable when a RadioButton is not selected. My current syntax is: <CheckBox IsEnabled="{Binding ElementName=rbBoth, Path=IsChecked}">Show all</CheckBox> So basically, I want IsEnabled to take the opposite value than the binding expression I'm currently supplying. How can I do this? Thanks. 回答1: You need to use what's called a value converter (a class that implements IValueConverter.)

How to set IsReadOnly / IsEnabled on entire container like Panel or GroupBox using XAML?

廉价感情. 提交于 2019-12-05 16:39:07
I have a MVVM application that contains multiple views with some complex IsReadOnly rules based on user permissions, view/edit mode and object state. I would like to set IsReadOnly and/or IsEnabled properties for entire groups of controls in the same container ( GroupBox / StackPanel / Grid / UserControl / etc.). The value of this property will be defined in ViewModel. I've got 3-6 different SomeGroupIsReadOnly properties per UserControl (with a large number of input controls like TextBox , RadioButtons , ComboBoxes and some DataGrids ) and I'm looking for a generic, MVVM -friendly solution,

WPF element databinding for IsEnabled (but for false)

╄→尐↘猪︶ㄣ 提交于 2019-12-04 06:59:35
I'm a starter in WPF, and there's something I can't seem to figure out. I have a CheckBox that I would like to disable when a RadioButton is not selected. My current syntax is: <CheckBox IsEnabled="{Binding ElementName=rbBoth, Path=IsChecked}">Show all</CheckBox> So basically, I want IsEnabled to take the opposite value than the binding expression I'm currently supplying. How can I do this? Thanks. You need to use what's called a value converter (a class that implements IValueConverter.) A very basic example of such a class is shown below. (Watch for clipping...) public class NegateConverter :

multiple binding to IsEnable

邮差的信 提交于 2019-12-04 02:39:48
I need to bind a TextBox that meets two criteria: IsEnabled if Text.Length > 0 IsEnabled if user.IsEnabled Where user.IsEnabled is pulled from a data source. I was wondering if anyone had a easy method for doing this. Here is the XAML: <ContentControl IsEnabled="{Binding Path=Enabled, Source={StaticResource UserInfo}}"> <TextBox DataContext="{DynamicResource UserInfo}" Text="{Binding FirstName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding Path=Text, RelativeSource={RelativeSource Self}, Converter={StaticResource LengthToBool}}"/> </ContentControl> Since you only need

C# WPF IsEnabled using multiple bindings?

六眼飞鱼酱① 提交于 2019-11-28 06:43:34
I have a WPF xaml file describing a section of a GUI and I'd like the enabling/disabling of a particular control to be dependent on two others. The code looks something like this at the moment: <ComboBox Name="MyComboBox" IsEnabled="{Binding ElementName=SomeCheckBox, Path=IsChecked}"/> But I'd like it to be dependant on another checkbox as well so something like: <ComboBox Name="MyComboBox" IsEnabled="{Binding ElementName=SomeCheckBox&AnotherCheckbox, Path=IsChecked}"/> What's the best way to go about that? I can't help feeling I'm missing something obvious or going about this the wrong way? I

Adding a convention for IsEnabled to Caliburn.Micro

谁说胖子不能爱 提交于 2019-11-27 21:39:37
How do I add a custom convention to Caliburn.Micro for the IsEnabled property of controls - something like having NameEnabled bound to IsEnabled in parallel to Name bound to Text on a TextBox. In a way, what I want to achieve is similar to the way that a CanSave property can be used to enable/disable a button bound to a Save method, but generic for all controls. Caliburn.Micro right now ( 1.3.1 ) doesn't really support this "multiple" conventions for the same FrameworkElement , what you have described. EDIT : However you can hook into the ViewModelBinder.BindProperties method and there you can

Adding a convention for IsEnabled to Caliburn.Micro

﹥>﹥吖頭↗ 提交于 2019-11-26 20:45:05
问题 How do I add a custom convention to Caliburn.Micro for the IsEnabled property of controls - something like having NameEnabled bound to IsEnabled in parallel to Name bound to Text on a TextBox. In a way, what I want to achieve is similar to the way that a CanSave property can be used to enable/disable a button bound to a Save method, but generic for all controls. 回答1: Caliburn.Micro right now ( 1.3.1 ) doesn't really support this "multiple" conventions for the same FrameworkElement , what you