StickyLabel.axaml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <Styles xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:controls="using:AvaloniaApplication1.Controls">
  4. <Design.PreviewWith>
  5. <controls:StickyLabel Text = "fooooooooo"
  6. Background = "White"
  7. BorderBrush ="Black"
  8. BorderThickness = "1"
  9. Padding ="5"
  10. SideOrientation = "Right"
  11. CornerSize="150"
  12. Foreground="Black"
  13. Width="200"
  14. Height="40"
  15. FontSize="16"
  16. VerticalAlignment = "Center"
  17. />
  18. </Design.PreviewWith>
  19. <Style Selector="controls|StickyLabel">
  20. <!-- Set Defaults -->
  21. <Setter Property="Template">
  22. <ControlTemplate>
  23. <Border x:Name="PART_StickyLabel"
  24. Background="{Binding Background, RelativeSource={RelativeSource TemplatedParent}}"
  25. BorderBrush="{Binding BorderBrush, RelativeSource={RelativeSource TemplatedParent}}"
  26. BorderThickness="{Binding BorderThickness, RelativeSource={RelativeSource TemplatedParent}}"
  27. Padding="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}}"
  28. Margin="{Binding Margin, RelativeSource={RelativeSource TemplatedParent}}">
  29. <TextBlock
  30. VerticalAlignment = "{Binding VerticalAlignment, RelativeSource={RelativeSource TemplatedParent}}"
  31. HorizontalAlignment = "{Binding HorizontalAlignment, RelativeSource={RelativeSource TemplatedParent}}"
  32. Foreground="{Binding Foreground, RelativeSource={RelativeSource TemplatedParent}}"
  33. Text="{Binding Text, RelativeSource={RelativeSource TemplatedParent}}"
  34. TextTrimming="CharacterEllipsis"
  35. />
  36. </Border>
  37. </ControlTemplate>
  38. </Setter>
  39. </Style>
  40. </Styles>