TextViewer
- Ausgelagert - Zwischenablage Text Kopieren
This commit is contained in:
@@ -320,6 +320,10 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="View\Controls\TextViewer.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="View\Controls\ValueListEntryEditControl.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
@@ -1083,6 +1087,9 @@
|
||||
<Compile Include="View\Controls\ListboxSelectControl.xaml.cs">
|
||||
<DependentUpon>ListboxSelectControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View\Controls\TextViewer.xaml.cs">
|
||||
<DependentUpon>TextViewer.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View\Controls\ValueListEntryEditControl.xaml.cs">
|
||||
<DependentUpon>ValueListEntryEditControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using BeWo.View.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -20,28 +21,12 @@ namespace BeWo.View
|
||||
|
||||
public static BeWoWindow GetTextViewer(string title, string text, double min_height, double height, double max_height, double min_width, double width, double max_width)
|
||||
{
|
||||
var control = new TextBlock();
|
||||
|
||||
var control = new TextViewer();
|
||||
control.Text = text;
|
||||
|
||||
var scrollviewer = new ScrollViewer();
|
||||
|
||||
scrollviewer.Content = control;
|
||||
|
||||
var beWoWindow = new BeWoWindow();
|
||||
|
||||
beWoWindow.Height = height;
|
||||
beWoWindow.MinHeight = min_height;
|
||||
beWoWindow.MaxHeight= max_height;
|
||||
beWoWindow.Width = width;
|
||||
beWoWindow.MinWidth = min_width;
|
||||
beWoWindow.MaxHeight = max_width;
|
||||
|
||||
beWoWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
||||
beWoWindow.GroupBoxContent = scrollviewer;
|
||||
beWoWindow.Owner = BeWoApp.CurrentBeWo.MainWindow;
|
||||
beWoWindow.rootGroupBox.Header = title;
|
||||
|
||||
var beWoWindow = GetGenericBeWoWindow(title, min_height, height, max_height, min_width, width, max_width);
|
||||
beWoWindow.GroupBoxContent = control;
|
||||
|
||||
return beWoWindow;
|
||||
}
|
||||
|
||||
@@ -49,5 +34,23 @@ namespace BeWo.View
|
||||
{
|
||||
MessageBox.Show(text, "Fehler", MessageBoxButton.OK, MessageBoxImage.Asterisk);
|
||||
}
|
||||
|
||||
private static BeWoWindow GetGenericBeWoWindow(string title, double min_height, double height, double max_height, double min_width, double width, double max_width)
|
||||
{
|
||||
var beWoWindow = new BeWoWindow();
|
||||
|
||||
beWoWindow.Height = height;
|
||||
beWoWindow.MinHeight = min_height;
|
||||
beWoWindow.MaxHeight = max_height;
|
||||
beWoWindow.Width = width;
|
||||
beWoWindow.MinWidth = min_width;
|
||||
beWoWindow.MaxHeight = max_width;
|
||||
|
||||
beWoWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
||||
beWoWindow.Owner = BeWoApp.CurrentBeWo.MainWindow;
|
||||
beWoWindow.rootGroupBox.Header = title;
|
||||
|
||||
return beWoWindow;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
23
BeWo/View/Controls/TextViewer.xaml
Normal file
23
BeWo/View/Controls/TextViewer.xaml
Normal file
@@ -0,0 +1,23 @@
|
||||
<UserControl x:Class="BeWo.View.Controls.TextViewer"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:BeWo.View.Controls"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
||||
<TextBlock x:Name="txt">
|
||||
|
||||
</TextBlock>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
|
||||
<Button Grid.Row="1" Content="Inhalt in Zwischenablage kopieren" Click="Button_Click"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
35
BeWo/View/Controls/TextViewer.xaml.cs
Normal file
35
BeWo/View/Controls/TextViewer.xaml.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace BeWo.View.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für TextViewer.xaml
|
||||
/// </summary>
|
||||
public partial class TextViewer : UserControl
|
||||
{
|
||||
public TextViewer()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public string Text { get => txt.Text; set => txt.Text = value; }
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Clipboard.SetText(Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user