How to change bubble color in Chat WPF

1 Answer 74 Views
Chat (Conversational UI)
Alexander
Top achievements
Rank 1
Alexander asked on 12 Nov 2021, 06:21 AM
How to set custom color on currentauthor bubble (inlinemessage) in Chat Conversation UI on WPF? 

1 Answer, 1 is accepted

Sort by
0
Stenly
Telerik team
answered on 16 Nov 2021, 03:05 PM

Hello Alexander,

You could achieve the wanted result by creating an implicit Style targeting the TextMessageControl element. The DataContext of the element is TextMessage. This object has Author property, which could be used to set the Background property, via a DataTrigger trigger:

<Style TargetType="chat:TextMessageControl">
    <Style.Triggers>
        <DataTrigger Binding="{Binding Author.Name}" Value="DefaultAuthor">
            <Setter Property="Background" Value="red"/>
        </DataTrigger>
    </Style.Triggers>
</Style>

In order to target the TextMessageControl type, you would need to add the following namespace:

<Window xmlns:chat="clr-namespace:Telerik.Windows.Controls.ConversationalUI;assembly=Telerik.Windows.Controls.ConversationalUI" />

With this said, I hope the provided information works in your current project scenario.

Regards,
Stenly
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Chat (Conversational UI)
Asked by
Alexander
Top achievements
Rank 1
Answers by
Stenly
Telerik team
Share this question
or