Search This Blog

Showing posts with label WinForms. Show all posts
Showing posts with label WinForms. Show all posts

Saturday, June 9, 2018

ATTENTION !!! This personal blog no longer gets new posts

Please follow the official XAF Team and XPO Team blogs, which are regularly updated by me and other DevExpress members.
Thanks, Dennis.

------------------------------------------
In XAF, users of the Model Editor and Report Designer tools are likely to be affected by this issue. Well, advanced users who enabled the ShowPropertyGrid property in the layout control or made custom PropertyGridControl integrations may be affected too - at least we all know a few😉

Our XtraVerticalGrid developers are aware of this problem and have already fixed it in v18.1.4 (it should be out in 1.5-2 weeks). In the meantime, the hotfix is already available for download at T638535: PropertyGridControl - The NullReferenceException is thrown when scrolling and an editor is active. Please accept sincerely apologies from our XAF, XtraReports and XtraVerticalGrid teams for all the inconvenience here.

Here is the error callstack for your reference:

System.NullReferenceException at DevExpress.XtraVerticalGrid.PGEditingState.MouseWheel(DevExpress.Utils.MouseWheelScrollClientArgs) at DevExpress.XtraVerticalGrid.BaseHandler.DevExpress.Utils.IMouseWheelScrollClient.OnMouseWheel(DevExpress.Utils.MouseWheelScrollClientArgs) at DevExpress.Utils.MouseWheelScrollHelper.OnScrollLine(DevExpress.Utils.DXMouseEventArgs, Int32, Boolean) at DevExpress.Utils.MouseWheelScrollHelper.OnMouseWheel(System.Windows.Forms.MouseEventArgs) at DevExpress.XtraVerticalGrid.BaseHandler.OnMouseWheel(System.Windows.Forms.MouseEventArgs) at DevExpress.XtraVerticalGrid.VGridControlBase.OnMouseWheelCore(System.Windows.Forms.MouseEventArgs) at DevExpress.XtraEditors.Container.EditorContainer.OnMouseWheel(System.Windows.Forms.MouseEventArgs) at System.Windows.Forms.Control.WmMouseWheel(System.Windows.Forms.Message ByRef) at System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef) at DevExpress.XtraEditors.Container.EditorContainer.WndProc(System.Windows.Forms.Message ByRef) at DevExpress.XtraVerticalGrid.VGridControlBase.WndProc(System.Windows.Forms.Message ByRef) at System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef) at System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr, Int32, IntPtr, IntPtr)


Tip 1: The How to obtain a design-time exception call stack KB article describes how to locate these important error details, especially if your Visual Studio crashed. This information is helpful when submitting to support. BTW, to improve your chances of getting a faster and helpful answer from support, check these related tips as well:
   How do I ask a good question? (StackOverFlow)
   How to Report Bugs Effectively (Simon Tatham)
   A request for simple example programs (Julian Bucknall)
   Collect and Analyze the Diagnostic Information (XAF documentation)


Tip 2: When you located the call stack information and determined from it that an exception is raised from DevExpress code, I recommend you search for one or several topmost call stack method names in our support database. This behavior might be reported by someone else, e.g.: https://www.google.com/search?q=PGEditingState.MouseWheel


FreeImages.com

Thursday, May 31, 2018

WinForms - How to manage long text in DocumentManager tabs

Please check out the Problem and Solutions sections in the T629226: WinForms - Long text is cut off in DocumentManager tabs ticket.

We are going to improve this in the upcoming v18.1+. Our designer's favorite is #2, but we cannot implement it in a minor version due to a breaking change. BTW, option #1 shown in the screenshot below also looks fine. Take note of solution #3 as well - you can customize this behavior without writing any code.


Please let me know what option you prefer or if you are handling it differently. Thanks.

BTW, have you modernized your XAF WinForms apps using SVG icons and Light Style in v18.1? Click the screenshot below to see the new look & feel. Do you like it?


Wednesday, April 25, 2018

UPDATE on Customization Forms - XAF WinForms v18.1.3+

With v18.1.3 (RTM or Beta2), a tooltip will be shown for complex property paths to avoid confusion from fields with the same name. Refer to the attached video:



Note that since multiple customization forms can be opened at the same time, now the form's header also includes the View's caption. We hope your end-users will appreciate these minor usability improvements. Refer to the original Support Center ticket for more details.

See Also:
Customization Forms and Model Editor Improvements - XAF v17.2.6

Thursday, March 8, 2018

XAF WinForms v17.2.6 - Beware of missing icons in inactive tabs after restoring the Tabbed MDI layout

I want to draw your attention to the T611846: DocumentManager - TabbedView does not show images for documents issue already fixed in the XtraBars Suite and which XAF WinForms Tabbed MDI users might encounter after upgrading to v17.2.6. The number of users who already hit this exceeded a certain threshold, and the known issues section in the What's New documentation or manual searching the Support Center may not help effectively discover it yourself. So, I am posting this here to widely inform those who have not yet upgraded their XAF/WinForms projects to v17.2.6.

You can also download a hotfix build from here.

Please accept sincerely apologies from our XAF and XtraBars teams for all the inconvenience here.


Wednesday, February 7, 2018

Faster opening of a DetailView with lots of items - XAF WinForms v17.2.6

How big is the DetailView in the question? 
Well, in the T581043 ticket's test project, there are 250 editors in the detail form layout. Big enough, huh?

FreeImages.com/Marcello eM


How much we could speed it up? 
On our powerful test machines, the time to open DetailView with just plain editors (no layout groups or tabs) has dropped from 3 seconds to almost 1. In real world applications, time to open a detail view depends on the application configuration (controllers, data, collection properties, calculated fields) and deployment specifics.

If you cannot wait for the next maintenance update (v17.2.6), install this night buildDevExpressNETComponents-17.2.exe

My team and I would be interested in hearing whether it is something you and your clients will notice too or if there are any problems with that new build. Thanks in advance.

Regards,
Dennis

P.S. If you already migrated to XAF v17.2, make sure you set XafApplication > OptimizedControllersCreation to True as well (read the prerequisites in the docs, first). The How to measure and improve the application's performance article may also help your app perform faster (magically, just after looking at it😜), so check it as well in case of problems in other scenarios.

Monday, November 27, 2017

How to show Color Swatches for the Bezier skin and persist the user choice in XAF WinForms apps

If you are a fan of the new SVG Bezier skin, our WinForms components received in v17.2, do not miss the XAF integration on the subject:

https://www.devexpress.com/kb=T579152

Both theWinForms and XAF teams are looking forward to hearing from you on this new feature. Learn more about this major release from our What's New documents.


Friday, April 21, 2017

Documentation updates with regard to ways to resize windows in XAF

We have recently updated our online documentation in this regard, so you may be interested to check it out:
    Task-Based Help > How to: Adjust the Size and Style of Pop-up Dialogs (WinForms)
    Task-Based Help > How to: Adjust the Size and Style of Pop-up Dialogs (ASP.NET)

Attentive readers could notice that the PopupWindowShowAction.CustomizePopupWindowParams event arguments now provide the new Size and Maximized properties that can be used to specify the popup window size from a platform-agnostic module in certain cases (check the end of both articles above for more details on the limitations).

Of course, these code solutions can be further improved based on your business requirements. For instance, if you want to provide a developer or application user with the capability to specify sizes in the Model Editor, you can extend required View node types (e.g., IModelView) with the Width and Height attributes in the Application Model and then modify the aforementioned code to read these attributes respectively. Refer to the eXpressApp Framework > Concepts > Application Model > Extend and Customize the Application Model in Code article for more details.


Please tell me about your experience with these solutions or about anything you would love to improve in this regard. Thanks in advance.

FreeImages.com/Carolina Rodríguez

Monday, March 20, 2017

More enhancements to the High DPI support in WinForms XAF applications - YOUR FEEDBACK IS NEEDED!

A month ago, I announced the High DPI support in WinForms XAF applications. 

XAF team continues making improvements in this area based on your great feedback in Support Center. We would like to share our progress with you and would greatly appreciate your leaving a comment here.

Tuesday, March 14, 2017

XAF app performance: Reducing the number of simultaneous database connections



Multiple simultaneously opened connections consume your database server memory and thus, have negative impact on your application performance. To diagnose this situation, you can use the following SQL script:

SELECT 
    DB_NAME(dbid) as DBName, 
    COUNT(dbid) as NumberOfConnections,
    loginame as LoginName
FROM
    sys.sysprocesses
WHERE 
    dbid > 0
GROUP BY 
    dbid, loginame

Thankfully, there is a couple of tricks to optimize your existing apps in production (they are already applied out of the box in new projects).


Wednesday, March 8, 2017

Preview of toast notifications using a platform-agnostic method in XAF v16.2.5 - YOUR FEEDBACK IS NEEDED!!!

I am still forcing myself to go to sleep after watching an unreal football drama in Barcelona, so I am writing this short blog post at night.
Besides Visual Studio 2017 official support, XAF v16.2.5 delivers a small gem, which I cannot hide from you too long. Remember that this is an early preview of the functionality we hope to officially release by v17.1 and which is have polished in the coming 2-3 months. So, your feedback is welcome, as always!

Typical usage

Let's modify the platform-agnostic Controller from our demo (C:\Users\Public\Documents\DevExpress Demos 16.2\Components\eXpressApp Framework\SimpleProjectManager\CS\SimpleProjectManager.Module\Controllers\ProjectTaskController.cs) by adding the Application.ShowViewStrategy.ShowMessage call at the end of the Execute event handler:
...
            markCompletedAction.Execute += (s, e) => {
                IObjectSpace viewDataContext = View.ObjectSpace;
                foreach(ProjectTask task in e.SelectedObjects) {
                    task.EndDate = DateTime.Now;
                    task.Status = ProjectTaskStatus.Completed;
                    viewDataContext.SetModified(task); // Mark the changed object as 'dirty' (only required if data properties do not provide change notifications).
                }
                viewDataContext.CommitChanges();
                //viewDataContext.Refresh(); // Optionally update the UI in accordance with the latest data changes.
                Application.ShowViewStrategy.ShowMessage(string.Format("{0} task(s) have been completed!", e.SelectedObjects.Count), InformationType.Success, 4000, InformationPosition.Top);
            };
...
Now, let's start the Windows and Web apps, select a few uncompleted tasks in the ProjectTask ListView and execute the Done! command from the menu.

Result in the UI for various platforms

Web
A nice notification window is managed using the dxToast widget (invoked via the  DevExpress.ui.notify method) from our DevExtreme HTML5/JavaScript library:



Tuesday, March 7, 2017

How to customize the New Object Action with a single item to display a simple button instead of a dropdown in WinForms


UPDATE:
See the latest post on this matter at Usability change for SingleChoiceAction with a single sub-item - YOUR FEEDBACK IS NEEDED!!!
-----------------------------------------------------------------------
I would like to promote an updated/simplified v16.2 solution for this task after introduction of the ActionBase > CustomizeControl event. To remind you the context, let me quote myself from the https://www.devexpress.com/kb=Q497985 thread:



"XAF allows defining whether a SingleChoiceAction click should show a dropdown or execute an action item immediately using the ShowItemsOnClick and DefaultItemMode  properties. You can easily change these properties based on the number of the New action items. However, a triangle glyph is always shown by default. The SingleChoiceAction does not currently provide built-in means for replacing a dropdown with a simple button either. Currently, to improve user experience with such configurations, you can customize the underlying bar item in the YourSolutionName.Module.Win project.


You can use the following controller to hide a drop-down list from the NewObjectAction in case it contains only one element:


using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.ExpressApp.Win.SystemModule;
using DevExpress.XtraBars;
...
namespace YourSolutionName.Module.Win.Controllers {
    public class CustomizeNewActionController : WindowController {
        BarButtonItem newActionBarButtonItem;
        protected override void OnFrameAssigned() {
            base.OnFrameAssigned();
            WinNewObjectViewController newObjectViewController = Frame.GetController<WinNewObjectViewController>();
            SingleChoiceAction newObjectAction = newObjectViewController.NewObjectAction;
            newObjectAction.CustomizeControl += NewObjectAction_CustomizeControl;
            newObjectAction.ItemsChanged += NewObjectAction_ItemsChanged;
        }
        private void NewObjectAction_ItemsChanged(object sender, ItemsChangedEventArgs e) {
            if(newActionBarButtonItem != null) {
                SingleChoiceAction newObjectAction = (SingleChoiceAction)sender;
                int choicesCount = newObjectAction.Items.Count;
                if(choicesCount == 1) {
                    newActionBarButtonItem.ButtonStyle = BarButtonStyle.Default;
                }
            }
        }
        private void NewObjectAction_CustomizeControl(object sender, CustomizeControlEventArgs e) {
            newActionBarButtonItem = e.Control as BarButtonItem;
        }
    }
}




Here are screenshots showing the results in the application UI before and after this customization.


Before


After


Also, you can use the same approach with the CloneObjectAction (it is a part of the CloneObjectViewController). Refer to the following documentation articles to learn more about this solution:
    Concepts > Extend Functionality > Built-in Controllers and Actions 
    Concepts > Extend Functionality > Customize Controllers and Actions 
    Task-Based Help > How to: Customize Action Controls
    DevExpress.XtraBars > BarButtonItem > ButtonStyle 
    DevExpress.XtraBars > BarButtonItem > ActAsDropDown 


For older versions
Check out the How to display a dropdown without a triangle glyph for a SingleChoiceAction ticket for code examples."

Thursday, February 16, 2017

Enhanced High DPI support in WinForms XAF applications - YOUR FEEDBACK IS NEEDED!

UPDATED:
Refer to the More enhancements to the High DPI support in WinForms XAF applications - YOUR FEEDBACK IS NEEDED! post for the most recent improvements in this regard.
====

In this post, I will describe how to make your WinForms XAF application look much better if your Windows 7, 8 or 10 is configured to show text and other items larger (150-200% or more which is a usual setting on High DPI (4K) display devices).



The following animation demonstrates the difference between the default and DPI-Aware scaling: http://i.imgur.com/Kgv4geP.gif

This functionality is already available in the most recent XAF update (16.2.4). However, there are several High DPI related bugs that we have fixed after this release. That is why I recommend you to download this hotfix before trying High DPI: DevExpressComponents-16.2.4.17046.exe

In this hotfix, the DPI-aware scaling is already enabled in XAF demos and design-time tools.



Proceed to see how to enable it in your applications.

Friday, January 20, 2017

XAF WinForms v16.2.3 - Beware of exceptions when executing a ParametrizedAction (e.g. FullTextSearchAction) with TabbedMDI and Ribbon UI

I want to draw your attention to the T462973 - RibbonControl - NullReferenceException is thrown in the RibbonItemViewInfoCalculator.CalcEditItemViewInfo method issue already fixed in the XtraBars Suite for v16.2.3 and which XAF WinForms users might encounter after upgrading to v16.2.3. The number of users who already hit this exceeded a certain threshold, and the known issues section in the What's New documentation or manual searching the Support Center may not help effectively discover it yourself. Frankly speaking, we are a bit late with this warning, but it is still better to post this here to widely inform those who have not yet upgraded their XAF/WinForms projects to v16.2.3.

You can find more details and solution instructions in this article.





Please accept sincerely apologies from our XAF and XtraBars teams for all the inconvenience here.

Monday, December 19, 2016

How to view and edit only time values without the date part

I would like to promote a new KB article on integrating the WinForms TimeEdit and ASP.NET WebForms ASPxTimeEdit components in XAF:



My team and I would greatly appreciate it if you leave comments on whether you experienced similar tasks in the past and how you were solving them, or if you remember any difficulties with these solutions/maintenance.




Wednesday, December 7, 2016

Object reference not set to an instance of an object. Part 2.

Before you get totally overwhelmed with the upcoming major v16.2 release (learn quick about XAF bits there), I want to further discuss troubleshooting errors while debugging your app, which is something any developer has to do regularly regardless of the used development tools.

Problem
If you have followed my blog for a long time, you may recall my first post devoted to this problem.
In short, it talks about debugging and analyzing exceptions in Visual Studio or looking into the built-in XAF log file for them. More information on the subject is also available in the online documentation at Concepts > Debugging and Error Handling
Unfortunately, we still receive quite a lot support calls with just this meaningless screenshots like " Object reference not set to an instance of an object" or similar without any callstacks, inner exceptions, loaded assemblies or any other meaningful diagnostic information that would allow us to help users in the most effective manner. Since such a screenshot does not provide any opportunity to the author or us to learn about the underlying cause of the error, an unnecessary clarification turn around and an accompanying delay always occurs in this case... This is certainly bad for both sides and thus is something we seek to avoid.

Possible solution
With v16.2, XAF WinForms apps will display a better error dialog while you are debugging your app:


We have not integrated a similar thing in the Web UI yet because the ASP.NET platform already provides quite a rich error page where the original problem was less noticeable, at least according to our internal figures.

Notice that the extended error form now  not only displays the top-most error message, but also shows the full call stack for you to research or copy to the DevExpress support crew, if necessary. At the bottom, there is also a link to the new help article describing the most common troubleshooting techniques that should help you save time and hunt "bugs" more effectively. In the majority of cases, these pointers should be sufficient to either research/fix your own custom code or submit an effective ticket to the Support Center, if the underlying issue has something to do with DevExpress routines.

This dialog should NOT appear when no debugger is attached to your app, e.g., when your end-users use your app in production - the former dialog will be shown there to avoid any possible confusion concerning technical details, as in previous versions.

Your feedback is needed!
We hope this will help our users and us to eliminate unnecessary delays and speed up overall problems troubleshooting in Visual Studio. As always, we are also looking forward to hearing from you on this small, but necessary service feature. For instance, to better communicate to developers that it is for development time only, we are also thinking about appending something like " (Debugging...)" to the form title, near the app name or adding some clarification tooltip on mouse hover. Or, is it already clear enough? Please let me know what you think. 
I also welcome other thoughts on solving the original problem in case we overlooked something.

Thursday, October 13, 2016

How to map Actions to a certain RibbonPage and RibbonGroup via the Application Model

This is my second post about advanced ribbon menu customizations in XAF WinForms apps. This time I want to repost two possible solutions for the aforementioned task after reviewing and updating the code of one good (and never old - Hi, Noxe!:-)) customer recently. This work was done after an interview about my Simplifying customization of Action controls - YOUR FEEDBACK IS NEEDED! post. Take a look at it if you haven't yet. 


Long story short, refer to the https://www.devexpress.com/kb=S134617 ticket and find two possible Controller implementations. Even though the first one (RibbonFromModelWithEventController.cs) requires more code to implement, I like it more, because it does not require you to create an Action Container node manually in the Model Editor. With the first one, you just specify the TargetRibbonPage and TargetRibbonGroup properties for a required Action under the ActionDesign node and you are done:


In any case, I suggest you play with both implementations and watch the attached video to determine what is more suitable for you. I look forward to hearing from you in the comments section or in the Support Center, as always.


I do not want to focus much on the Controller code itself, just want to note that there we extended the standard IModelAction interface corresponding to the ActionDesign | Action node and then handled these new options in our code. This is one of my favorite Application Model features, which is also truly loved by our customers. In fact, everything you see in our framework is built using the same simple principle: you have certain UI metadata or settings store and have some Controllers in modules that create/customize visual controls accordingly. To learn more about this, refer to the Concepts > Application Model > Extend and Customize the Application Model in Code article in our online documentation. This is a really cool feature and it can help you create a more reusable code.

Wednesday, October 5, 2016

How to place all nested View commands into the main ribbon and activate them based on the selected layout tab

My next two posts will be devoted to advanced ribbon menu customizations in WinForms, which become much easier to implement with the introduction of the new Ribbon and Standard templates (WinApplication.UseOldTemplates = False) back in v14.2 and also API changes in the recent XAF versions.

The current post is about mapping ALL Actions from the nested Frame toolbar into the main ribbon menu by creating a separate page. It is planned that when you activate a certain nested ListView within a layout tab, its related View commands will be activated in a separate ribbon page as well (context-dependent commands). This somewhat exotic approach was requested a few times by different customers and is likely dictated by users who have a habit of using only the main ribbon menu, i.e., without moving the mouse to the bottom context.

The two pictures showing how it was before and after making necessary code changes + a video showing everything in action are worth a thousand words in communicating this effect in the real app.
Context-dependent Actions in ribbon

Wednesday, August 3, 2016

Usability improvements to the Model Editor layout designer and more in XAF v16.1.5

The recently released minor update brings several small, but useful features I hope you and your end-users will appreciate.

1. The layout designer available in the Model Editor at design time and runtime now generates a layout very close to what you can see in the end app. In particular, being invoked for the WinForms modules or apps, it now generates real Property Editors (in the disabled state and with fake data) instead of equivalent text boxes or bricks. It also tries to take into account and visualize the most popular layout and other options like ToolTip, ShowCaption, etc. IMHO, the most useful thing here is that you can now customize embedded ListView elements or List Property Editors corresponding to collection properties much easier via the grid control, like you can already do under the Views | ListView | Columns node. Even though the layout designer invoked for Web modules will not display real Web controls, but rather their corresponding WinForms analogs, the overall development experience will be better than before.




Tuesday, May 24, 2016

WinForms GridListEditor - How to restore values in the auto filter row

I wanted to inform you of a recent solution update for this task, which will help you restore auto filter row values for reference properties as well (previously, there might be an exception). The main change is in wrapping the GridView.GuessAutoFilterRowValuesFromFilter call into the using(var criteriaScope = View.ObjectSpace.CreateParseCriteriaScope()) {...} construction, which relies on the smart DevExpress.Data.Filtering > CriteriaOperator > UserValueParse event  handling inside our XPO/EF core libraries

using System;
using DevExpress.XtraGrid;
using DevExpress.ExpressApp;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.ExpressApp.Win.Editors;

namespace MainDemo.Module.Win {
    public class B152594 : ViewController<ListView> {
        GridListEditor gridlistEditor = null;
        protected override void OnViewControlsCreated() {
            base.OnViewControlsCreated();
            gridlistEditor = View.Editor as GridListEditor;
            if(gridlistEditor != null) {
                gridlistEditor.Grid.HandleCreated += Grid_HandleCreated;
            }
        }
        private void Grid_HandleCreated(object sender, EventArgs args) {
            GridControl grid = (GridControl)sender;
            grid.HandleCreated -= Grid_HandleCreated;
            using(var criteriaScope = View.ObjectSpace.CreateParseCriteriaScope()) {//!!!
                ((GridView)grid.MainView).GuessAutoFilterRowValuesFromFilter();
            }
        }
    }
}

After you modify the filter either by manually typing values in the topmost grid row or visually via the filter builder and reopen the form, there will be the following result in the UI:


I think your end-users will appreciate this functionality and I would be grateful to hear from you on how this works in your apps and whether there are any uncovered scenarios. Thanks! 

Wednesday, March 30, 2016

How to change font settings for all or individual UI elements (toolbar and context menus, property editors, etc.) per View or globally

I want to inform you of my recent updates to the corresponding Support Center article as I think it may be interesting for the XAF community.


Take special note that the current dynamic solution for WinForms may be greatly simplified in future versions (no additional BarAndDockingController customizations in the Window.TemplateChanged  event handler), because I discussed this with the leaders of our WinForms team.