默认手机 UI(尤其是短信)的 XAML 模板

本文关键字:XAML 模板 手机 UI 尤其是 默认 | 更新日期: 2023-09-27 18:33:48

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

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

我也非常感谢诺基亚提供的开发人员社区的任何链接。

默认手机 UI(尤其是短信)的 XAML 模板

您的 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>