maximized close case dialog
This commit is contained in:
@@ -88,7 +88,6 @@
|
||||
</UserControl.Resources>
|
||||
|
||||
<ScrollViewer x:Name="DialogContentScrollViewer"
|
||||
Height="570"
|
||||
Padding="0 0 5 0"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
Focusable="True">
|
||||
|
||||
@@ -2736,6 +2736,23 @@ namespace FasdDesktopUi.Basics.UserControls
|
||||
}
|
||||
}
|
||||
|
||||
public void SetDialogContentMaxHeight(double maxHeight)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (DialogContentScrollViewer == null)
|
||||
return;
|
||||
|
||||
// Keep dialog usable on very small screens, but allow larger monitors to use space.
|
||||
var clamped = Math.Max(220, Math.Min(900, maxHeight));
|
||||
DialogContentScrollViewer.MaxHeight = clamped;
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
}
|
||||
|
||||
private void DropDownClosed(object sender, EventArgs e)
|
||||
{
|
||||
if (!(sender is FrameworkElement fe)) return;
|
||||
|
||||
@@ -9,6 +9,9 @@ using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using WinForms = System.Windows.Forms;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
|
||||
namespace FasdDesktopUi.Pages.TicketCompletion
|
||||
@@ -50,6 +53,18 @@ namespace FasdDesktopUi.Pages.TicketCompletion
|
||||
cFocusInvoker.LostFocus += ElementLostFocus;
|
||||
}
|
||||
|
||||
protected override void OnSourceInitialized(EventArgs e)
|
||||
{
|
||||
base.OnSourceInitialized(e);
|
||||
UpdateDialogMaxHeightToScreen();
|
||||
}
|
||||
|
||||
protected override void OnLocationChanged(EventArgs e)
|
||||
{
|
||||
base.OnLocationChanged(e);
|
||||
UpdateDialogMaxHeightToScreen();
|
||||
}
|
||||
|
||||
#region ClosingBusy
|
||||
|
||||
public bool IsClosingBusy
|
||||
@@ -126,6 +141,38 @@ namespace FasdDesktopUi.Pages.TicketCompletion
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateDialogMaxHeightToScreen()
|
||||
{
|
||||
try
|
||||
{
|
||||
WinForms.Screen screen = null;
|
||||
IntPtr currentHandle = new WindowInteropHelper(this).Handle;
|
||||
|
||||
if (currentHandle != IntPtr.Zero)
|
||||
{
|
||||
screen = WinForms.Screen.FromHandle(currentHandle);
|
||||
}
|
||||
else if (Owner != null)
|
||||
{
|
||||
IntPtr ownerHandle = new WindowInteropHelper(Owner).Handle;
|
||||
if (ownerHandle != IntPtr.Zero)
|
||||
screen = WinForms.Screen.FromHandle(ownerHandle);
|
||||
}
|
||||
|
||||
screen = screen ?? WinForms.Screen.PrimaryScreen;
|
||||
var workingArea = screen?.WorkingArea ?? WinForms.Screen.PrimaryScreen.WorkingArea;
|
||||
var dpiScaleY = VisualTreeHelper.GetDpi(this).DpiScaleY;
|
||||
var maxHeightDip = (workingArea.Height / Math.Max(0.1, dpiScaleY)) - 12;
|
||||
|
||||
MaxHeight = Math.Max(220, maxHeightDip);
|
||||
CloseCaseDialogUc?.SetDialogContentMaxHeight(MaxHeight - 180);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
#region Internal Focus Events
|
||||
|
||||
private void ElementGotFocus(object sender, EventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user