如何禁用在Telerik的RadConversationView中选择项目的功能

时间:2014-02-08 23:44:36

标签: telerik windows-phone

我正在使用RadConversationView来显示聊天。 有默认的能力来选择一个项目,它会破坏标准的接受颜色,我试图避免。

XAML:

 <tlr:RadConversationView Name="ConversationView"
                                     ItemsSource="{Binding Messages}"
                                     SendingMessage="ConversationView_OnSendingMessage"
                                     MessageTemplateSelector="{StaticResource MessageTemplateSelector}"
                                     >
            </tlr:RadConversationView>

消息模板(传入和传出略有不同)

<DataTemplate x:Key="IncomingMessageTemplate">
    <Grid Margin="12">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="3*"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <primitives:RadPointerContentControl Background="{StaticResource BrownBrush}"
                                             TargetPoint="-150,-300">
            <primitives:RadPointerContentControl.PointerTemplate>
                <DataTemplate>
                    <Polygon Width="12"
                             Height="24"
                             Points="0,0 12,0 12,12 0,24"
                             StrokeThickness="0"
                             Fill="{StaticResource BrownBrush}"
                             RenderTransformOrigin="0.5, 0.5">
                        <Polygon.RenderTransform>
                            <ScaleTransform ScaleX="-1"/>
                        </Polygon.RenderTransform>
                    </Polygon>
                </DataTemplate>
            </primitives:RadPointerContentControl.PointerTemplate>

            <StackPanel>
                <TextBlock Text="{Binding Body}"
                   TextWrapping="Wrap"
                   Margin="12"/>
                <TextBlock Text="{Binding Time}" FontSize="14" FontWeight="Bold"
                   Margin="12, 0, 12, 12"
                   HorizontalAlignment="Left"/>
            </StackPanel>
        </primitives:RadPointerContentControl>
    </Grid>
</DataTemplate>

如何禁用此行为?

1 个答案:

答案 0 :(得分:0)

最简单的解决方案是覆盖datatemplate中的TextBlock样式,将前台恢复为默认值:

<DataTemplate x:Key="IncomingMessageTemplate">
    <Grid Margin="12">
        <Grid.Resources>
            <Style TargetType="TextBlock">
                <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}" />
            </Style>
        </Grid.Resources>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="3*"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <primitives:RadPointerContentControl Background="{StaticResource BrownBrush}"
                                             TargetPoint="-150,-300">
            <primitives:RadPointerContentControl.PointerTemplate>
                <DataTemplate>
                    <Polygon Width="12"
                             Height="24"
                             Points="0,0 12,0 12,12 0,24"
                             StrokeThickness="0"
                             Fill="{StaticResource BrownBrush}"
                             RenderTransformOrigin="0.5, 0.5">
                        <Polygon.RenderTransform>
                            <ScaleTransform ScaleX="-1"/>
                        </Polygon.RenderTransform>
                    </Polygon>
                </DataTemplate>
            </primitives:RadPointerContentControl.PointerTemplate>

            <StackPanel>
                <TextBlock Text="{Binding Body}"
                   TextWrapping="Wrap"
                   Margin="12"/>
                <TextBlock Text="{Binding Time}" FontSize="14" FontWeight="Bold"
                   Margin="12, 0, 12, 12"
                   HorizontalAlignment="Left"/>
            </StackPanel>
        </primitives:RadPointerContentControl>
    </Grid>
</DataTemplate>