I need to set the initial state of PrintPreviewDialog controls in App.config.
in case of loss of source code, here is the scenario:
Every time the user calls the print dialog it should open with 80% zoom instead of 100%
Related
I have been tasked with creating a like for like user interface for a product replacement.
One of the components of the old system was a container that displayed properties in a hierarchy (think treeview like) where each property had a label and value (value could be a textbox, drop down, checkbox, file browse etc)
This is the component that I need to replace and one of the conditions being imposed on me is to front load it with about 5000 items, some of which will be made visible depending on usage context.
My first attempt has been to use a FlowLayoutPanel as the main container populated by TableLayoutPanels indented on left margin that each hold label and edit control.
I hit the problem of the 10,000 control handles limit.
Any suggestions on an alterantive approach to get round this limitation that will allow for the front loading of the 5000 items?
Thanks in advance.
Consider the following guidelines:
1. Do not load all the records at once. Load the data page by page as per request, and render each page of data.
2. Do not show all the records at once. You have a limited window size, even if you load all the data, just show the part that should be visible in the view port. Show the rest of the data when the user scrolls. This way you can dispose the previous elements.
3. Do not use a lot of handles. You can use a control which uses just 1 control handle, like a TreeView or DataGridView or even a custom control for yourself. The key is keeping data in view mode and just show the edit controls when the user focus on a specific item to edit.
Example: DataGridView and ListView controls support virtual mode for loading data. You can also simulate nested data by padding the first cell/item. Also the Treeview control supports events like BeforeExpand which allows you to load child data when the user requests.
For all above examples you can just show the edit controls when the user wants to edit the cell.
I have a page that programmatically shows a popup in a backing bean method. The popup asks the user a Yes/No question, and the subsequent logical path followed is determined by their response. However, whether the popup is shown or not in the first place is conditional. Also, there is additional logic in the original method, outside of the popup logic, that must be completed.
The issue with this is that ADF seems to spin off the popup into another thread, and keeps executing the logic in the original method simultaneously, while waiting for the user's response. However, the desired effect is that the program halts until the user has answered the question in the popup.
I haven't been able to figure out an elegant way to make this to happen. Ideally, I think the solution is to encapsulate the logic that occurs after the popup is shown (or not shown) in the original method, and call it from the popup's action listener if the popup is shown (otherwise call it from the original method). However, the logic to be encapsulated requires the use of some local variables that were set before the popup was shown. There's no way to get these values to the popup's action listener method in order to pass them to the encapsulated logic (aside from creating global static variables in the bean, which seems like a poor solution).
Another idea I had was to bump up the "show/don't show popup" logic to the task flow. However, it seems that doing this for every single popup would make the task flow really complicated.
Is there a better way to do this? It must be a common issue, and it seems that I'm going about it all wrong.
ETA: I have tried setting the popup's ContentDelivery property to "immediate", and the af:dialog component within the popup so Modal is "true". Neither has produced the desired behavior.
This can't be achieved with a server-side web framework.
For ADF, you will have different events for each lifecycle:
1 - popup opening :: popupFetchListener event
2 - click on OK, Cancel buttons ::DialogListener event
3 - hit Esc button :: popupCancelledEvent
You can share data between these events either on pageFlowScope, or viewScope.
But if you use ADF BC, you may be better off using transient attributes on View Objects.
In WPF, when designing forms, it is common to disable form elements (such as buttons/commands or entire areas) in response to the state of the View Model. This is easily done by having the CanExecute check the various properties on the View Model.
However, this breaks the User Experience when an element is dependent on the element immediately preceding it and the user wants to move focus (either through tab or using the mouse).
Example: Say I have a login form that requires a username and a password. Both fields must be non-empty before the Login button can be pressed. The problem is that the binding for the Password is not updated until focus has been lost, but when that happens the button has not been enabled yet. So focus moves on to the element following that, instead of focusing on the Login button.
This can generally be easily solved by changing the binding to update on PropertyChanged. However, this may not always be a good user experience. In cases of expensive validation, you want to limit how often the user has to wait. Or if an input element has a minimum length and I'm providing visual error notifications, I don't want to warn the user while they are typing.
Is there a better way of solving this problem?
And is there a reason why bindings update after focus was lost, instead of at the time focus is about to be lost? Ideally the element would lose focus, the binding would update, then the container would determine what element to focus on next.
You can throttle the execution of updating the BindingSource by setting the Delay property on the Binding element.
This is useful when you know your validation check is expensive, or if you want to make sure the user has stopped typing before giving them validation results.
Ex.
//Delays updating the binding source by 1000 ms
<TextBox Text="{Binding Password, Delay=1000}" />
I have a View and View Model. The View Model has a bool on there (Foo.CanSelect) that on change will set off a data trigger in the View.
This applies some funky fade out animation, and sets the visibility to collapsed in the final key frame. This is all well and good for the current session, but when I bring the app out from a tombstoning event (de-serialize it) the view is Visible again.
Foo.CanSelect is the correct value but it isn’t bound to the Visibility, because if it was, when the property is changed the visible state is immediately collapsed.
Am I going about this the wrong way?
You could persist the value of Foo.CanSelect when the application is tombstoned, and then read it on restore and update the visibility of the element accordingly. It may be easier to use visual states instead and simply store the required state on tombstoning and restore that state on resume.
I am trying to implement Zoom feature on a DesignSurface, which uses .Net 2 based Designer time architecture.
I have two approaches to handle ZoomChanged event:
Unload the Design surface and reload with Zoomed content.
Identify the affected properties and set them to Zoomed values of properties.
Problem:
In approach 1, Unload and Reload is quite a task for run-time and would unload and reload lot of properties which would not be affected by zoom change.
In approach 2, The properties being changed would raise lot of PropertyChanged events and execute relative handlers, which would make response quite slow. If, I want to unsubscribe and resubscribe all the event handlers, I would not have any single place to do it as it spans over lot of dependent components.
Any one at rescue?