UWP: Content Dialogs & Popups

I ran into an annoying visual problem with eclecdec, where a Popup that overlays (partially or entirely) a ContentDialog ends up with a gray translucent overlay at the intersection point of the two. Like this:

Popup before

While the gray translucent overlay doesn’t interfere with user interaction with the Popup’s controls, it’s annoying and ugly and looks sloppy.
It turns out that someone (not me) is adding a Shadow to the Border element that contains the ContentDialog’s content. It took me quite a while to find this using the Visual Studio Visual Tree Navigator. Once I did, it was a relatively simple matter to walk back up the visual tree (from an element in the content, not from the ContentDialog itself), find the offending Border element, and set the Shadow to null. Like this:


private void clearBorderShadow(UIElement childElement)
{
if (childElement != null)
{
DependencyObject child = childElement;
DependencyObject parent;

while ((parent = VisualTreeHelper.GetParent(child)) as UIElement != null)
{
if (parent is Border)
{
Border border = parent as Border;
if (border.Name == "BackgroundElement”)
{
border.Shadow = null;
break;
}
}

child = parent;
}
}
}

If you’ve subclassed ContentDialog, you can call this method in an Opened event handler. Or, you can call it before you open a Popup.

It’s goofy, and I still don’t know who is adding the Shadow, but I’m not willing to spend any more time looking. Most importantly, it works – safely:

Popup after

Windows UWP Version Adaptive Code

UWP applications are the constant recipients of new functionality. This is, obviously, a good thing for those of us who’d like to build a meaningful user experience a la WPF or WinForms.

My first experience with writing Version Adaptive Code comes as a result of trying to remove the super-annoying selection flyout in the RichEditBox (which, unsurprisingly, I use for editing in eclecdec). This appeared in the Windows 10 October 2018 Update (1809), and has been driving me crazy, because I already provide the formatting options in the eclecdec ribbon, and I find it gets in my way and disturbs my flow:

Continue reading “Windows UWP Version Adaptive Code”

UWP Apps & the On-Screen Keyboard

It seems that I’m always surprised that Windows 10 can be used in tablet mode.  I mean, intellectually I know you can do it, but in practice I rarely do.  I suspect this is more tied to historical use patterns than anything else, and I suspect that a lot of (most?) users are in the same boat.

The problem that arises out of this blind spot though, is that we (okay, me) as developers don’t necessarily put the same kind of effort into good tablet operation as we might on a touch-first platform like Android or iOS.  So we (I) create a vicious circle  where apps don’t “do the right thing” in tablet mode, and users avoid it.

I ran into this a week or so ago when I pulled the keyboard off my Surface Go and started doing some editing in eclecdec.
Continue reading “UWP Apps & the On-Screen Keyboard”

App Close Confirmation

I’m not sure why it’s such a pain to catch the closing of a UWP application (specifically, I’m talking about the [X] button, which is kind of easy to mistakenly hit with a fat finger).  Certainly WPF applications don’t have this same kind of difficulty.

But really, doesn’t it seem that it should be a given that if you’re working on something and accidentally (or forgetfully) try to close the app that you be given a chance to save your work?
Continue reading “App Close Confirmation”

eclecdec 1.1.69.0

The latest version of eclecdec has been submitted and should be available in anywhere from a few hours to a few days.

Changes for this version are bug fixes:

  • Typing in the writing timer dialog added two numbers for reach keypress (fixed by replacing a 3rd party control with my own)
  • Today and Yesterday status only took into account first editing session
  • Crash when stopping the writing timer when it was already paused
  • App close button now prompts to save editing changes (this is an interesting one – see my follow on post)

Like I said, availability depends on the Windows Store approval time, so the new version should appear (at the longest) in a few days.

eclecdec 1.1.68.0

I recently updated eclecdec to 1.1.68.0, with these changes:

Features

  • Add ability to create a new card from a selection, while editing a story card

Bug Fixes

  • Fix a bug where suspending eclecdec while editing a new (unsaved) card can cause the card to be duplicated, resulting in two cards referencing the same content, and preventing deletion of one without deleting the content of both
  • Fix a bug where returning to a previously edited card correctly places the cursor where editing left off, but improperly selects text past the selection

Continue reading “eclecdec 1.1.68.0”