MainWindow.xaml
(开头部分) 13KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<Window x:Class="MyApp.MainWindow"
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:system="clr-namespace:System;assembly=mscorlib"
xmlns:local="clr-namespace:MyApp"
mc:Ignorable="d"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
d:DataContext="{d:DesignInstance Type=local:MainWindowViewModel}"
Title="MainWindow" Height="600" Width="850">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Button.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Shadows.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ToggleButton.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<!--<Border BorderThickness="3" CornerRadius="6">-->
<Border BorderBrush="Pink" BorderThickness="3" CornerRadius="6" Background="MistyRose">
<Grid x:Name="Root" Margin="4">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Border BorderBrush="White" BorderThickness="2" CornerRadius="6" Padding="4">
<StackPanel>
<StackPanel Orientation="Horizontal">
<StackPanel.Effect>
<DropShadowEffect Color="LightGray" />
</StackPanel.Effect>
<TextBlock Text="欢迎光临" FontSize="60" FontFamily="LiShu" />
<!--绑定到MainWindowViewModel中的Restaurant属性类的Name属性上-->
<TextBlock Text="{Binding Restaurant.Name}" FontSize="60" FontFamily="LiShu" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="小店地址:" FontSize="24" FontFamily="LiShu" />
<!--绑定到MainWindowViewModel中的Restaurant属性类的Address属性上-->
<TextBlock Text="{Binding Restaurant.Address}" FontSize="24" FontFamily="LiShu" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="订餐电话:" FontSize="24" FontFamily="LiShu" />
<!--绑定到MainWindowViewModel中的Restaurant属性类的PhoneNumber属性上-->
<TextBlock Text="{Binding Restaurant.PhoneNumber}" FontSize="24" FontFamily="LiShu" />
</StackPanel>
</StackPanel>
</Border>
<!--把DataGrid的ItemSource绑定到MainWindowViewModel中的DishMenu属性类上-->
<DataGrid AutoGenerateColumns="False" GridLinesVisibility="None" CanUserDeleteRows="False"
CanUserAddRows="False" Margin="0,4" Grid.Row="1" FontSize="16" ItemsSource="{Binding DishMenu}">
<!-- ColumnHeaderStyle 表头样式 -->
<DataGrid.ColumnHeaderStyle>
<Style TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>
</DataGrid.ColumnHeaderStyle>
后面还有 144 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
