<Grid >
<Grid x:Name="bubble_right" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Right"
Visibility="{Binding showright}" MinWidth="80">
<Grid Margin="5,5,15,5" MaxWidth="400" MinWidth="50" MinHeight="80">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="15"/>
<ColumnDefinition Width="80"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Grid.Column="0" Grid.RowSpan="2" MaxWidth="400">
<Rectangle StrokeThickness="0" Fill="#FF6accfd" RadiusY="4" RadiusX="4" Margin="0,10,0,0" MaxWidth="400" MinWidth="100"/>
<StackPanel Orientation="Vertical" MaxWidth="400">
<TextBlock FontSize="24" Text="为飞撒的反馈师傅" Grid.Column="0" Padding="5,0" MinWidth="30"
Foreground="Black" Margin="5,20,5,0" Tag="0" TextAlignment="Left" TextWrapping="Wrap" />
<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="2015-12-21 12:12:15" Foreground="Black"
VerticalAlignment="Top" Height="16" Margin="5,0,5,5" Grid.Column="0" FontSize="15"/>
</StackPanel>
</Grid>
<Path Data="M29.5,14 L25.25,14 L25.25,17.75" Fill="#ffdadada" HorizontalAlignment="Left" Grid.Column="1"
Height="16" Stretch="Fill" Stroke="Transparent" VerticalAlignment="Top" Width="15" StrokeThickness="0" Margin="0,20,0,0"/>
<Grid Grid.Column="2" Grid.RowSpan="2" Margin="0,5" Width="80">
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<Image Source="/Assets/sound.png" Grid.Row="0"/>
<Image Source="/Assets/PrivateMsgLock.png" Width="30" Grid.Row="1" Margin="25,0"/>
</Grid>
</Grid>
</Grid>
<Grid x:Name="bubble_left" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left"
Visibility="{Binding showleft}" MinWidth="80">
<Grid Margin="5,5,15,5" MaxWidth="400" MinWidth="50" MinHeight="80">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"/>
<ColumnDefinition Width="15"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Grid.Column="2" Grid.RowSpan="2" MaxWidth="400">
<Rectangle StrokeThickness="0" Fill="#FF6accfd" RadiusY="4" RadiusX="4" Margin="0,10,0,0" MaxWidth="400" MinWidth="100"/>
<StackPanel Orientation="Vertical" MaxWidth="400">
<TextBlock FontSize="24" x:Name="inTB" Text="动" Grid.Column="2" Padding="5,0" MinWidth="30"
Foreground="Black" Margin="5,20,5,0" Tag="0" TextAlignment="Left" TextWrapping="Wrap" />
<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="2015-12-21 12:12:15" Foreground="Black"
VerticalAlignment="Top" Height="16" Margin="5,0,5,5" Grid.Column="2" FontSize="15"/>
</StackPanel>
</Grid>
<Grid Grid.Column="0" Grid.RowSpan="2" Margin="0,5" Width="80">
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<Image Source="/Assets/sound.png" Grid.Row="0"/>
<Image Source="/Assets/PrivateMsgLock.png" Width="30" Grid.Row="1" Margin="25,0"/>
</Grid>
<Path Data="M29.5,14 L25.25,14 L25.25,17.75" Fill="#FF6accfd" HorizontalAlignment="Left"
Height="16" Stretch="Fill" Stroke="Transparent" VerticalAlignment="Top" Width="15" StrokeThickness="0"
Margin="0,20,0,0" UseLayoutRounding="False" Grid.Column="1" RenderTransformOrigin="0.5,0.5">
<Path.RenderTransform>
<CompositeTransform ScaleX="-1"/>
</Path.RenderTransform>
</Path>
</Grid>
</Grid>
</Grid>

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<ListBox x:Name="list" Margin="0,0,0,155" Background="White" ItemsSource="{Binding}" ItemTemplate="{StaticResource DataTemplate2}">
<!-- 确保listboxitem被stretch到listbox的宽度 -->
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>

<TextBox x:Name="inputbox" Margin="0,453,0,72" TextWrapping="Wrap"
Text="TextBox" Background="#BFE4AFAF"
BorderBrush="#BF906060"
Padding="1" SelectionBackground="#FFE21BB4" />
<Button Content="Add to right" Grid.Row="1" Height="72" HorizontalAlignment="Left"
Margin="0,535,0,0" Name="button1" VerticalAlignment="Top" Width="181" FontSize="20" Click="button1_Click" />
<Button Content="Add to Left" Height="72" HorizontalAlignment="Left"
Margin="186,535,0,0" Name="button2" VerticalAlignment="Top" Width="181" FontSize="20" Click="button2_Click" />
</Grid>

public class msg_class
{
public String content { get; set; }
public Visibility showleft { get; set; }
public Visibility showright { get; set; }

public msg_class(String content, Visibility showleft, Visibility showright)
{
this.content = content;
this.showleft = showleft;
this.showright = showright;
}
}

void showmsg(String msg, bool isself)
{
if (isself)
{
list.Items.Add(new msg_class(msg, Visibility.Collapsed, Visibility.Visible));
}
else
{
list.Items.Add(new msg_class(msg, Visibility.Visible, Visibility.Collapsed));
};
}

void readmsg(int index)
{
string s = ((msg_class)(list.Items[index])).content;
list.Items[index] = new msg_class(s, Visibility.Visible, Visibility.Collapsed);
}

private void button1_Click(object sender, RoutedEventArgs e)
{
showmsg("我地方暗示法sdf撒的反馈地方发生的疯狂暗示法的是嘎达", true);
list.ScrollIntoView(list.Items[0]);
}

private void button2_Click(object sender, RoutedEventArgs e)
{
showmsg(inputbox.Text, false);
list.ScrollIntoView(list.Items[0]);
}

wp8 入门到精通 聊天控件的更多相关文章

  1. 【番外篇】ASP.NET MVC快速入门之免费jQuery控件库(MVC5+EF6)

    目录 [第一篇]ASP.NET MVC快速入门之数据库操作(MVC5+EF6) [第二篇]ASP.NET MVC快速入门之数据注解(MVC5+EF6) [第三篇]ASP.NET MVC快速入门之安全策 ...

  2. UWP入门(五)--控件模板

    原文:UWP入门(五)--控件模板 通过在 XAML 框架中创建控件模板,你可以自定义控件的可视结构和可视行为(eg:勾选框的三种状态). 控件有多个属性,如 Background.Foregroun ...

  3. 2013 duilib入门简明教程 -- 复杂控件介绍 (13)

      首先将本节要介绍的控件全部拖到界面上,并调整好位置,如图:           然后将Name属性改成其他名字,          不能是[控件名+UI+数字]这种,因为这是DuiDesigner ...

  4. [深入浅出WP8.1(Runtime)]浮出控件(Flyout)

    4.15 浮出控件(Flyout) 浮出控件(Flyout)是一个轻型的辅助型的弹出控件,通常会作为提示或者要求用户进行相关的交互来使用.Flyout控件与Windows Phone里面的弹出框Mes ...

  5. 2013 duilib入门简明教程 -- 简单控件介绍 (12)

        前面的教程应该让大家对duilib的整体有所映像了,下面就来介绍下duilib具体控件的使用.     由于官方没有提供默认的控件样式,所以我就尽量使用win7或者XP自带的按钮样式了,虽然界 ...

  6. wp8 入门到精通 ImageCompress 图片压缩

    //实例化选择器 PhotoChooserTask photoChooserTask = new PhotoChooserTask(); BitmapImage bimg; int newPixelW ...

  7. wp8 入门到精通

    <StackPanel Orientation="Vertical"> <StackPanel Orientation="Horizontal" ...

  8. WP8.1开发中ListView控件加载图列表的简单使用(1)

    我也是刚接触WP编程没几个月,就是在这段时间一直闲着没事,然后又比较喜欢WP这款系统,就学习了WP这方面的开发言语,自学是很困难的,掌握这方面的资料不多,很初级,就是自己在网上找资料学习过程中,看到别 ...

  9. 3.WP8.1开发_为控件增加动画

    示例: 把一个按钮的宽度从100变到500 根据WPF的经验,会把代码写成如下: <Grid> <Button x:Name="btn" Content=&quo ...

随机推荐

  1. jQuery操作checkbox实例

    示意图 <script type="text/javascript"> $(function () { $("#ddlNumber").change ...

  2. 如何用js控件div的滚动条,让它在内容更新时自动滚到底部?

    三种控制DIV内容滚动的方法: 方法一:使用锚标记要滚动到的位置,然后通过click方法模拟点击滚动到锚所在位置 <script language="javascript1.2&quo ...

  3. Struts2学习笔记《二》

    struts.xml配置文件的全部配置元素:

  4. Linux下Apache配置SSL支持https

    参考:http://www.thinksaas.cn/group/topic/280017/ 生成证书过程如下 Step :生成服务器密钥: mkdir -p /etc/pki/test cd /et ...

  5. RRD

    http://my.oschina.net/u/1458120/blog/208857

  6. Zookeeper服务常用的操作命令

    Zookeeper服务安装之后,一般会在这个服务的基础之上安装其他的大数据平台,其他的框架一般会提供很多接口对Zookeeper中的内容进行一定的操作,但是功能相对单一,所以有些时候,有必要我们自己登 ...

  7. Java for LeetCode 207 Course Schedule【Medium】

    There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prer ...

  8. (译)利用ASP.NET加密和解密Web.config中连接字符串

    介绍 这篇文章我将介绍如何利用ASP.NET来加密和解密Web.config中连接字符串 背景描述 在以前的博客中,我写了许多关于介绍 Asp.net, Gridview, SQL Server, A ...

  9. IOS- 02 零碎知识总结

    1.UIView,UIViewController,UIWindow和CALayer UIView是什么,做什么:UIView是用来显示内容的,可以处理用户事件 CALayer是什么,做什么:CALa ...

  10. Hibernate查询语句

    1 hql查询 Hibernate的查询语句,hiberante提供的面向对象的查询语言,和sql语句的语法的相似.而且严格区分大小写. 1.1 from字句 /** * hql: from 字句 * ...