优化布局

This commit is contained in:
Kaniu Tayou
2018-12-29 08:28:31 +08:00
parent 688a53a9dd
commit b95581b63c
8 changed files with 63 additions and 11 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ namespace StormChatWPF
StormClient.OnLoginDone += OnHaveLogin; StormClient.OnLoginDone += OnHaveLogin;
StormClient.OnGetUserListDone += OnGetContactsList; StormClient.OnGetUserListDone += OnGetContactsList;
StormClient.OnMessage +=OnMessage;//事件挂接 StormClient.OnMessage +=OnMessage;//事件挂接
User.DefaultPhoto = new MemoryStream(File.ReadAllBytes(@"../../UI/Resources/默认头像.png")); User.DefaultPhoto = new MemoryStream(File.ReadAllBytes(@"../../UI/Resources/默认头像.png"));//设定默认头像
} }
internal static User CurrentContact { get; set; }//设置当前联系人对象 internal static User CurrentContact { get; set; }//设置当前联系人对象
/// <summary> /// <summary>
@@ -19,9 +19,9 @@
<ColumnDefinition Width="200*"/> <ColumnDefinition Width="200*"/>
<ColumnDefinition Width="200*"/> <ColumnDefinition Width="200*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<ListView x:Name="UsersList" Margin="0,0,0,0" IsEnabled="True" SelectionChanged="UsersList_SelectionChanged" Grid.Row="1" Grid.RowSpan="2"> <ListView x:Name="UsersList" Margin="0,0,0,0" IsEnabled="True" SelectionChanged="UsersList_SelectionChanged" Grid.Row="1" Grid.RowSpan="2" HorizontalAlignment="Left" Width="198">
</ListView> </ListView>
<TextBox x:Name="InputBox" Margin="0,0,0,0" TextWrapping="Wrap" Text="" Grid.Row="2" Grid.ColumnSpan="3" Grid.Column="1" /> <TextBox x:Name="InputBox" Margin="200,0,0,0" TextWrapping="Wrap" Text="" Grid.Row="2" Grid.ColumnSpan="4" />
<Button Content="Send" HorizontalAlignment="Right" Margin="0,0,0,0" VerticalAlignment="Bottom" Width="75" Click="Button_Click" Height="20" Grid.Row="2" Grid.Column="3"/> <Button Content="Send" HorizontalAlignment="Right" Margin="0,0,0,0" VerticalAlignment="Bottom" Width="75" Click="Button_Click" Height="20" Grid.Row="2" Grid.Column="3"/>
<ScrollViewer Grid.ColumnSpan="3" Grid.Column="1" Margin="0,0,0,0" Grid.Row="1" > <ScrollViewer Grid.ColumnSpan="3" Grid.Column="1" Margin="0,0,0,0" Grid.Row="1" >
<ScrollViewer.Content> <ScrollViewer.Content>
@@ -8,7 +8,7 @@ using System.Windows.Controls;
namespace StormChatWPF namespace StormChatWPF
{ {
/// <summary> /// <summary>
/// UserWindow.xaml 的交互逻辑 /// MainWindow.xaml 的交互逻辑
/// </summary> /// </summary>
public partial class MainWindow : Window public partial class MainWindow : Window
{ {
@@ -70,6 +70,9 @@
<DependentUpon>Contacts.xaml</DependentUpon> <DependentUpon>Contacts.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="UI\ContactsInfo.cs" /> <Compile Include="UI\ContactsInfo.cs" />
<Compile Include="UI\UserMeHeadInfo.xaml.cs">
<DependentUpon>UserMeHeadInfo.xaml</DependentUpon>
</Compile>
<Compile Include="Window1.xaml.cs"> <Compile Include="Window1.xaml.cs">
<DependentUpon>Window1.xaml</DependentUpon> <DependentUpon>Window1.xaml</DependentUpon>
</Compile> </Compile>
@@ -93,6 +96,10 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="UI\UserMeHeadInfo.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Window1.xaml"> <Page Include="Window1.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
@@ -5,13 +5,13 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:StormChatWPF.UI" xmlns:local="clr-namespace:StormChatWPF.UI"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="40" d:DesignWidth="120" HorizontalAlignment="Stretch"> d:DesignHeight="40" d:DesignWidth="120">
<Grid> <Grid>
<WrapPanel Height="40" VerticalAlignment="Stretch"> <Grid.ColumnDefinitions>
<Image x:Name="HeadPicture" HorizontalAlignment="Left" Height="40" Width="40"/> <ColumnDefinition Width="40*"/>
<Label x:Name="text" Content="Label" Height="40" FontSize="14" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" HorizontalAlignment="Center"/> <ColumnDefinition Width="80*"/>
</WrapPanel> </Grid.ColumnDefinitions>
<Image x:Name="HeadPicture" HorizontalAlignment="Left" Height="40" Width="40"/>
<Label x:Name="text" Content="Label" Height="40" FontSize="14" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" HorizontalAlignment="Right" Grid.Column="1" Width="80"/>
</Grid> </Grid>
</UserControl> </UserControl>
@@ -14,6 +14,7 @@ namespace StormChatWPF.UI
image.EndInit(); image.EndInit();
HeadPicture.Source = image; HeadPicture.Source = image;
text.Content = user.NickName; text.Content = user.NickName;
Width = 120;
} }
BitmapImage image = new BitmapImage(); BitmapImage image = new BitmapImage();
} }
@@ -0,0 +1,17 @@
<UserControl x:Class="StormChatWPF.UI.UserMeHeadInfo"
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:StormChatWPF.UI"
mc:Ignorable="d"
d:DesignHeight="60" d:DesignWidth="200">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60*"/>
<ColumnDefinition Width="120*"/>
</Grid.ColumnDefinitions>
<Image x:Name="image" Height="60" Margin="0,0,0,0" VerticalAlignment="Top"/>
</Grid>
</UserControl>
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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 StormChatWPF.UI
{
/// <summary>
/// UserMeHeadInfo.xaml 的交互逻辑
/// </summary>
public partial class UserMeHeadInfo : UserControl
{
public UserMeHeadInfo()
{
InitializeComponent();
}
}
}