Капралов Александр Викторович 698922a7d1 Обновить 'readme.md' | 6 달 전 | |
---|---|---|
Windows | 6 달 전 | |
bin | 6 달 전 | |
img | 6 달 전 | |
model | 6 달 전 | |
obj | 6 달 전 | |
App.xaml | 6 달 전 | |
App.xaml.cs | 6 달 전 | |
AssemblyInfo.cs | 6 달 전 | |
MainWindow.xaml | 6 달 전 | |
MainWindow.xaml.cs | 6 달 전 | |
WpfAppA.csproj | 6 달 전 | |
WpfAppA.csproj.user | 6 달 전 | |
readme.md | 6 달 전 |
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 WpfAppA.model;
namespace WpfAppA.Windows
{
public partial class DetailWindow : Window
{
public Hero currentHero { get; set; }
public DetailWindow(Hero currentHero)
{
this.currentHero = currentHero;
InitializeComponent();
DataContext = this.currentHero;
}
private void ExitButton_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = true;
}
}
}
detailwindow.xaml
<Window x:Class="WpfAppA.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:WpfAppA.Windows"
mc:Ignorable="d"
Title="DetailWindow" Height="450" Width="800">
<Window.Resources>
<BitmapImage
x:Key='defaultImage'
UriSource='./img/2.jpg' />
</Window.Resources>
<Grid RenderTransformOrigin="0.498,0.573">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Image Source="{Binding ImageBitmap}" Grid.ColumnSpan="1" Margin="2,83,2,183"/>
<StackPanel
Grid.Column="1">
<TextBlock Text="Имя:">
<TextBlock Text="{Binding name}"/>
</TextBlock>
<TextBlock Text="Возраст:">
<TextBlock Text="{Binding Age}"/>
</TextBlock>
<TextBlock Text="Мощь:">
<TextBlock Text="{Binding power}"/>
</TextBlock>
<TextBlock Text="Раса:">
<TextBlock Text="{Binding race}"/>
</TextBlock>
<TextBlock Text="Дата выхода:">
<TextBlock Text="{Binding dateOfLastVaccination, StringFormat='dd.MM.yyyy'}"/>
</TextBlock>
</StackPanel>
<TextBlock Grid.Column="2" Text="{Binding Age}" Margin="0,2,10,0"/>
<Button IsCancel="True" Click="ExitButton_Click" Margin="20,280,46,26" Grid.Column="1" Background="IndianRed">OK</Button>
</Grid>
</Window>