isenabled

C# WPF IsEnabled using multiple bindings?

流过昼夜 提交于 2019-12-17 18:14:45
问题 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

WPF Binding to IsEnabled Property in ListBox' ContextMenu's MenuItem

最后都变了- 提交于 2019-12-13 08:44:02
问题 i was looking at the other threads regarding databinding to contextmenus but i couldnt figure out how to get it to work since the suggestions/answers wouldnt work for me. i have a listbox, which is bound to an ObversableCollection - that works fine. now i have a contextmenu inside that listbox. that contextmenu has 4 items to activate, deactivate etc the selected task (which is the item that is represented in the listbox). due to permissions, i need to control, wether the items in the

Disable Control's Selection Background Effect in WPF

匆匆过客 提交于 2019-12-13 05:27:39
问题 I have a ListView which shows a collection of objects. I want to disable the "Blue effect" or "Blue rectangle" when clicking on the ListViewItem, and Let only the object in this Item enabled. Does anyone has an idea about that ?? Here is an Example of one of my ListViewItems: Here is my listView: <ListView SelectionMode="Single" IsManipulationEnabled="True" HorizontalAlignment="Left" HorizontalContentAlignment="Stretch" VerticalAlignment="Stretch" ScrollViewer.VerticalScrollBarVisibility=

How to reset a WPF control's default opacity toggling via IsEnabled after setting opacity explictly?

杀马特。学长 韩版系。学妹 提交于 2019-12-12 01:38:22
问题 When I disable a control (button), it is so dark that it is very hard to read the text. So I am using an extension method to set the opacity to 1.0 (100%) so it can be read easily, even when disabled: public static void IsEnabledSpecial(this System.Windows.UIElement control, bool isEnabled) { control.IsEnabled = isEnabled; control.Opacity = 1.0; // This makes a disabled control more readable } Normally, when opacity is not explicitly set for a WPF control, it appears to toggle between 1.0

IsEnabled binding to a boolean

大城市里の小女人 提交于 2019-12-11 06:46:31
问题 I have a list a simple dialog box which contains a few checkboxes, I wanted to have an Ok button that would be disabled unless the user changed a setting. In my view I have an OkEnabled property that I was binding the isEnabled property of the button to, if a check box changes its value it sets OkEnabled to true, but for some reason this doesnt enable the button. public bool OkEnabled { get { return m_okEnabled; } set { m_okEnabled = value; OnPropertyChanged("OkEnabled"); } } <Button Content=

Making a Button IsEnabled state depend on two textboxes

耗尽温柔 提交于 2019-12-11 06:22:11
问题 I want to have a button's IsEnabled to only be true if two textboxes don't have any errors (in this case, I just want them to both be numeric) I tried setting the textboxes to NotifyOnValidationError=True, thinking this will raise an exception that bubbles up to a container control - I would then set the Button's IsEnabled to true based on the Validation.HasError attached property belonging to that control I tried the following (stripped of formatting code) but it's not working (the button is

WPF - No IsEnabled=true behavior using style with animations

江枫思渺然 提交于 2019-12-11 05:25:33
问题 I have asked a question here but then I realized my problem was not the code but the style I am using for a button. Since the problem is completely different than the one initially asked, I thought it would be more beneficial for other users if I just asked the "right" question again. Here I go: I am using the template below in my button. When I set button.IsEnabled=false it works ok but if I set button.IsEnabled=true it doesn't get enabled. Can you please pinpoint what I am doing wrong?

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

自作多情 提交于 2019-12-10 10:08:53
问题 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

multiple binding to IsEnable

大憨熊 提交于 2019-12-09 15:50:35
问题 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=

iPhone: programmatically check if vibration is enabled

匆匆过客 提交于 2019-12-08 10:37:51
问题 Is it possible to programmatically check if the system option of iPhone Settings -> Sounds -> Vibrate on Ring is enabled? In my app, I would like to display an alert to the user if that option is disabled. 回答1: You cannot. Because apple is not providing the API to access the iPhone settings app. 回答2: may be you could give it a try and make sure you're running the app in iDevice because simulator don't have silent or ring mode :) New Edits -(BOOL)silenced { #if TARGET_IPHONE_SIMULATOR //