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.
Related
I have virtual keyboard which should be hidden and i want to show it only when textbox get focus. I'm using mvvm so i dont want to write any code on code behind, so i want to make some trigger if it's possible which can watch all texboxes and set visibility on my virtual keyboard.
Or i can do it in controller but i cant find the way how to get current focused control
<DockPanel FocusManager.FocusedElement="{Binding FocusedElement, Mode=TwoWay}"
doesnt work
unfortunately didn't found solution to use triggers but atleast i can get IsFocused value using extension, got it from here Set focus on textbox in WPF from view model (C#)
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!
I am subscribed to the Loaded event of a Silverlight TextBox. I would like to access the Text property in this event. It works properly when I directly set the text, but when I am binding the Text property it is always empty. Is there way to do this without subscribing to the LayoutUpdated event instead?
please try using TextChanged property instead. :)
I'm trying to use the DataForm to display data. The CurrentItem is bound to a property on my ViewModel. The property it is bound to is a simple poco. I've created a custom readonly template. Everything works fine except I can't figure out how to make the DataForm appear "Enabled" or in the Normal state. The data isn't editable, it's displayed as readonly.
The only way I've been able to get it to display in the Normal state was to edit the template and set the Opacity to 100% for the DisabledVisual border.
Is there a better way to do this or use the DataForm for displaying data that isn't editable but still appear enabled?
This fixed it: jedwards14.blogspot.com/2011/02/silerlight-data-forms-with.html. I do have a busy indicator, apparently this is still and issue: silverlight.codeplex.com/workitem/4729
I've got a DataGrid with a Two-Way Binding on SelectedItem. I can change the SelectedItem in my ViewModel, but the DataGrid won't ScrollIntoView automatically.
Is there a way to do this without using a code-behind event handler that calls ScrollIntoView(SelectedItem), or should I just give in and use a little code-behind?
Check http://www.codeproject.com/Tips/125583/ScrollIntoView-for-a-DataGrid-when-using-MVVM.aspx