Service für app8 gebaut BeWoWindowBuilder Einführung: Zentraler Ort für generische, kleine Fenster, wie Text Viewer, Text Editor, Picture Shower, etc. Alte Gkv Abrechnungsansicht deaktiviert
96 lines
2.6 KiB
C#
96 lines
2.6 KiB
C#
using System;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Input;
|
|
|
|
namespace BeWo.View
|
|
{
|
|
/// <summary>
|
|
/// Interaktionslogik für BeWoWindow.xaml
|
|
/// </summary>
|
|
public partial class BeWoWindow : System.Windows.Window
|
|
{
|
|
private object _GroupBoxContent;
|
|
public object GroupBoxContent
|
|
{
|
|
get { return _GroupBoxContent; }
|
|
set
|
|
{
|
|
_GroupBoxContent = value;
|
|
rootGroupBox.Content = value;
|
|
}
|
|
}
|
|
|
|
public bool IsMaximizable = true;
|
|
|
|
public BeWoWindow()
|
|
{
|
|
InitializeComponent();
|
|
|
|
CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, (s, e) => Close()));
|
|
}
|
|
|
|
public BeWoWindow(FrameworkElement fe)
|
|
{
|
|
InitializeComponent();
|
|
|
|
rootGroupBox.Content = fe;
|
|
CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, (s, e) => Close()));
|
|
}
|
|
|
|
public BeWoWindow(FrameworkElement fe, string stylestring)
|
|
{
|
|
InitializeComponent();
|
|
|
|
rootGroupBox.Content = fe;
|
|
|
|
rootGroupBox.Style = (Style)FindResource(stylestring);
|
|
|
|
CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, (s, e) => Close()));
|
|
}
|
|
|
|
private void RootGroupBox_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
var p = e.GetPosition(this);
|
|
if (p.Y <= 40)
|
|
{
|
|
DragMove();
|
|
}
|
|
}
|
|
catch (Exception){}
|
|
}
|
|
|
|
private void RootGroupBox_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
|
|
{
|
|
if(!IsVisible)
|
|
{
|
|
return;
|
|
}
|
|
if (!IsMaximizable)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var pos = PointToScreen(Mouse.GetPosition(this));
|
|
|
|
if (!(e.OriginalSource is Border) && !(e.OriginalSource is TextBlock) || pos.Y > 200d || e.OriginalSource is TextBlock && Mouse.DirectlyOver is Button)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (WindowState == WindowState.Maximized)
|
|
{
|
|
WindowState = WindowState.Normal;
|
|
return;
|
|
}
|
|
|
|
if (WindowState == WindowState.Normal)
|
|
{
|
|
WindowState = WindowState.Maximized;
|
|
}
|
|
}
|
|
}
|
|
}
|