بدون توضیح

aleukhin 7f3c95119f 1st com 6 ماه پیش
.vs 7f3c95119f 1st com 6 ماه پیش
WpfApp1 7f3c95119f 1st com 6 ماه پیش
img 7f3c95119f 1st com 6 ماه پیش
WpfApp1.sln 7f3c95119f 1st com 6 ماه پیش
readme.md 7f3c95119f 1st com 6 ماه پیش

readme.md

Windows

Создание окна; добавление строки в mainwindow.cs

     private void WorkerListBox_MouseDoubleClick(
object sender,
MouseButtonEventArgs e)
     {

         var detailWindow = new DetailWindow(
            WorkerListBox.SelectedItem as Worker);

         detailWindow.ShowDialog();
     }
 }

DetailWindow.xaml.cs

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.Shapes;
using WpfApp1.model;

namespace WpfApp1.Windows
{

    public partial class DetailWindow : Window
    {
        public Worker currentWorker { get; set; }
        public DetailWindow(Worker currentWorker)
        {
            this.currentWorker = currentWorker;

            InitializeComponent();
            DataContext = this.currentWorker;
        }
        private void ExitButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;

        }
    }
}

DetailWindow.xaml

<Window x:Class="WpfApp1.Windows.DetailWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApp1.Windows"
        mc:Ignorable="d"
        Title="DetailWindow" Height="450" Width="800">
    <Grid RenderTransformOrigin="0.498,0.573">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="64"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="auto"/>
        </Grid.ColumnDefinitions>

        <Image Source="{Binding ImageBitmap}" Grid.ColumnSpan="1" Margin="2,83,2,183"/>
        <StackPanel  Orientation="Vertical" Margin="0,0,27,190" Grid.Column="1">
            <TextBlock Text="{Binding name}"/>
            <TextBlock Text="{Binding Pos}"/>
            <TextBlock Text="{Binding Sex}"/>
            <TextBlock Text="{Binding date, StringFormat='dd.MM.yyyy'}"/>
            <TextBlock Text="{Binding available}"/>
        </StackPanel>
        <TextBlock Grid.Column="2"  Text="{Binding Age}" Margin="0,2,10,0"/>
        <Button IsCancel="True" Click="ExitButton_Click" Margin="20,273,46,26" Grid.Column="1" Background="Pink">OK</Button>

    </Grid>
</Window>