1

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

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

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

4

1 回答 1

3

您的 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>
于 2013-10-03T11:48:01.087 回答