How to disable only the expander togglebutton WPF - xaml

I'm trying to disable the expander togglebutton dynamically using IsEnabled property and when I do that, the whole content is disabled also.
I want to disable the togglebutton while keeping the content controls enable.
Thank's
Elad

Make a copy of the style template for the Expander, find the toggle button within the template and set your IsEnabled property to it specifically instead of to the Expander control itself.
So, in Expression Blend right-click an Expander control and go to Edit Template -> Edit a Copy and save a copy of your template wherever you like, in most cases a resource dictionary is the best idea. Find the button object in the template that is your expander button and put your IsEnabled property there. Then just apply that style template to your expander control like <Expander Style="{StaticResource YourNewExpanderTemplateName}.../> so that the IsEnabled dependency property applies just to the button object instead of the entire control.
Give it a shot. Cheers!

Related

How do i manipulate the data templates inside listbox in uwp

I am making a chat application using XAML in UWP.The side panel is consisting of users. like this.
Everything is in Listbox in which I have this template that consists one ellipse as a circle which is like an indicator,one user image,textblocks and one toggle switch.I have to give states to the toggle switch in on the state it should change the green color of circle and make it red.
I want to give this functionality in code c# in MainPage.cs. I made the object of toggle in toggled Event Handler but I am not able to access the other elements inside the data template like ellispse,textblock.
What is the other alternative way of doing this?
NOTE: It has to be in listbox because I want to use the same template for every user.
The best way to do this would be to use data binding.
You would define a ViewModel class for the item, which would contain a bool property and would react to the toggling of the switch in the setter or have a Command which you would execute when the state event changes using behaviors.
If you really want the code as a event handler on main page, you have some options. To get the item associated with the toggle, you can use its DataContext property and cast it to the data type you are using. Alternatively, you can use Visual Tree Extesnions provided by the UWP Community Toolkit. This enables you to find the parent (probably Grid) where you store all the item controls and then manually find the user image, TextBlock, etc.

Set a ribbon togglebutton programmatically on load

I am trying to set a ribbon togglebutton to true at the start of outlook. I did not use the designer but used XML to design the ribbon. Creating an attribute of isChecked in the XML does not seem to be called or used in any way. Any ideas?
For the toggleButton element, the callback name is getPressed, not isChecked.

Is there a 'UpdateSourceTrigger' equivalent in Xamarin Forms?

I am using Xamarin.Forms, with my view created fully in XAML. I am also using Xamarin.Forms.Labs.
I have bound an EntryCell to a property like so:
<EntryCell Label="Name:" Text="{Binding Name, Mode=TwoWay}" />
The page has a 'Save' ToolBarItem which saves the property to a database.
The issue I have is that the Name property is only updated when the entry cell loses focus after the user changes the text. Clicking the ToolBarItem does not change focus and therefore the property is not updated before being saved.
I would like the property to be updated with every key press from the user. I know of 'UpdateSourceTrigger' for Silverlight, but I can't find an equivalent way to do this in Xamarin Forms?
There is no equivalent for UpdateSourceTrigger in Xamarin.Forms
There doesn't seem to be a xamarin equivalent to UpdateSourceTrigger. I have had success by removing the SetProperty call from the bound property so that the property changed does not fire, and then using EntryUnfocused to trigger an explicit PropertyChanged event.

Changing the colour or checkbox in MultiselectList in Windows Phone

In my application i am using MultiselectList for selecting a list of student information. Here my issue is that, I am using a black background image for my page,
Because of this in white theme, the checkbox portion is invisible. I try to edit the template of checkbox item in Blend, but failed, while editing the template its populating a huge chunk of code in XAML.
While editing template instead of style its generating Template (I edited the Multilist Item using Blend).
In the real application i am using itemtemplate and assign the resource to this item template.
So I don't know where to assign this template, and where to edit in that template to change my checkbox colour, this is a blocker issue for me, my friend told me that without theme support the app won’t pass market place submission.
Doing what you want to do, ie. editing the color of the checkbox, depending on the theme and background selected would be too much work. Have you tried using the default styles that come with Silverlight? For example, In this case, PhoneContrastbackgroundColor would be a good choice.
XAML code
<DataTemplate x:Key="whatever">
<TextBlock Text="ItemName"/>
<CheckBox BackgroundColor="{StaticResource PhoneContrastbackgroundColor}"/>
</DataTemplate>

vb.net How to make a DropDownList with readonly appearance

I am developing desktop application using vb.net and vs2008.
I have a DropDownList that I don't want it interact with use when the info is locked.
But if I disable it, it is greyed out and the text is not easy to read.
Is there any way to make radiobutton like readonly textbox?
I want text of the DropDownList looks black and itself is not clickable.
The above shows a disabled DropDownList with greyed out text and a readonly textbox
Try this:
Enable="false"
Place it within your <asp:DropDownList> tag.
I recently encountered a similar issue. My solution was to remove all other values of the DropDownList except the one that is selected. This will keep the text as black as opposed to grey. Users will be able see the existing value and click it but will not be able to change it.
Hope this helps.
No, you can't use CSS in a desktop app. When you disable the dropdownlist by setting Disabled=true; or Enabled=false (whatever the case is), you can also change the Font properties to make it easier to read. You can set other properties such as Border, BorderStyle, etc, etc.
Keep the control enabled. In the GOTFOCUS event, use SENDKEYS to send a {tab} to the form. the user will not be able to change it! By the way, workt for ALL controls, that a user can focus.