- Profilbilder werden in Gruppenchats (mehr als 2 Teilnehmer) angezeigt - Profilbilder werden im Cache gespeichert - Verbesserungen am Code
32 lines
1.0 KiB
C#
32 lines
1.0 KiB
C#
using System.Collections.ObjectModel;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Documents;
|
|
|
|
namespace ChatController.Core
|
|
{
|
|
public class BindableTextBlock : TextBlock
|
|
{
|
|
public ObservableCollection<Inline> InlineList
|
|
{
|
|
get => (ObservableCollection<Inline>) GetValue(InlineListProperty);
|
|
set => SetValue(InlineListProperty, value);
|
|
}
|
|
|
|
public static readonly DependencyProperty InlineListProperty = DependencyProperty.Register("InlineList", typeof(ObservableCollection<Inline>), typeof(BindableTextBlock), new UIPropertyMetadata(null, OnPropertyChanged));
|
|
|
|
public static void OnPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
|
{
|
|
if(e.NewValue == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var textBlock = (BindableTextBlock)sender;
|
|
|
|
textBlock.Inlines.Clear();
|
|
textBlock.Inlines.AddRange((ObservableCollection<Inline>) e.NewValue);
|
|
}
|
|
}
|
|
}
|