【问题标题】:XAML Templates for default winphone UI (especially SMS)默认 winphone UI(尤其是 SMS)的 XAML 模板
【发布时间】:2013-10-03 10:53:41
【问题描述】:

对于您在 Microsoft 应用程序甚至第三方应用程序(如 Facebook、Whatsapp 等)中看到的默认视图,是否有任何可用的免费 XAML 模板?

我正在寻找一个模板来显示消息线程,类似于 SMS 或 Whatsapp 应用程序中使用的模板。在开发我的应用程序(具有消息传递、更新和更多功能的社交平台应用程序)的过程中,我在实现默认 UI 视图时遇到了一些问题,因为微软似乎不支持我们作为开发人员。所以希望社区中的任何人都创建了一些模板并正在分享它们。

我还要感谢诺基亚提供的任何指向开发者社区的链接。

【问题讨论】:

标签: c# wpf xaml windows-phone-7 windows-phone-8


【解决方案1】:

您的 SMS 模板请求的快速而肮脏的解决方案就是这样。它尊重手机的强调色,但可能需要更多调整才能获得传入消息框和传出消息框的正确颜色差异。将颜色资源移到项目声明之外以确保它们被重复使用也是值得的。

<!-- incoming message template -->
<Grid Width="294" HorizontalAlignment="Left" Margin="20,0,0,10">
    <Grid.Resources>
        <SolidColorBrush x:Key="IncomingColor" Color="{StaticResource PhoneAccentColor}" />
        <SolidColorBrush x:Key="MessageForeground" Color="White" />
        <SolidColorBrush x:Key="TimeForeground" Color="White" Opacity="0.6" />
    </Grid.Resources>
    <Grid.RowDefinitions>
        <RowDefinition Height="18"/>
        <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
    <Path Fill="{StaticResource IncomingColor}" Data="M19 18 l 0 -18 l 24 18 z" />
    <Grid Background="{StaticResource IncomingColor}" Grid.Row="1">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <TextBlock Text="Message content goes in here. It should wrap and take as many lines as are required to display the whole thing" TextWrapping="Wrap" Margin="10,10,10,0" Foreground="{StaticResource MessageForeground}"/>
        <TextBlock Grid.Row="1" Text="17:53" Margin="10,0,10,10" HorizontalAlignment="Right" Foreground="{StaticResource TimeForeground}"/>
    </Grid>
</Grid>

<!-- outgoing message template -->
<Grid Width="294" HorizontalAlignment="Right" Margin="0,10,20,0">
    <Grid.Resources>
        <SolidColorBrush x:Key="OutgoingColor" Opacity="0.7" Color="{StaticResource PhoneAccentColor}" />
        <SolidColorBrush x:Key="MessageForeground" Color="White" />
        <SolidColorBrush x:Key="TimeForeground" Color="White" Opacity="0.6" />
    </Grid.Resources>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="18"/>
    </Grid.RowDefinitions>
    <Path Grid.Row="1" Fill="{StaticResource OutgoingColor}" Data="M 275 0 l 0 18 l -24 -18 z" />
    <Grid Background="{StaticResource OutgoingColor}" >
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <TextBlock Text="Message content goes in here." TextWrapping="Wrap" Margin="10,10,10,0" Foreground="{StaticResource MessageForeground}"/>
        <TextBlock Grid.Row="1" Text="17:53" Margin="10,0,10,10" HorizontalAlignment="Right" Foreground="{StaticResource TimeForeground}"/>
    </Grid>
</Grid>

【讨论】:

  • 非常感谢您提供此模板。请问,你是怎么想到这个的?您是从头开始编写 Xaml 代码还是使用了工具?
猜你喜欢
  • 1970-01-01
  • 2017-05-02
  • 2011-12-22
  • 2017-01-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-04-10
  • 2012-03-23
相关资源
最近更新 更多