Click here to Skip to main content
15,881,089 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Custom Control Styling Pin
Kevin Marois5-Dec-22 12:15
professionalKevin Marois5-Dec-22 12:15 
GeneralRe: Custom Control Styling Pin
Richard Deeming5-Dec-22 21:57
mveRichard Deeming5-Dec-22 21:57 
The AddOwner syntax lets you register another type for use with a DependencyProperty which has already been registered:
How to: Add an Owner Type for a Dependency Property - WPF .NET Framework | Microsoft Learn[^]
DependencyProperty.AddOwner Method (System.Windows) | Microsoft Learn[^]

You can't use the TextDecorations class[^] as the property type; that's a static class used to provide access to the standard text decorations. Instead, you need to use the TextDecorationCollection class[^] as the property type, which is what the Inlines.TextDecorations property[^] does:
C#
/// <summary>
/// DependencyProperty for <see cref="TextDecorations" /> property.
/// </summary>
public static readonly DependencyProperty TextDecorationsProperty = 
    DependencyProperty.Register(
        "TextDecorations", 
        typeof(TextDecorationCollection), 
        typeof(Inline),
        new FrameworkPropertyMetadata(
            new FreezableDefaultValueFactory(TextDecorationCollection.Empty), 
            FrameworkPropertyMetadataOptions.AffectsRender 
        ));

/// <summary>
/// The TextDecorations property specifies decorations that are added to the text of an element.
/// </summary>
public TextDecorationCollection TextDecorations
{
    get { return (TextDecorationCollection) GetValue(TextDecorationsProperty); }
    set { SetValue(TextDecorationsProperty, value); }
}




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

GeneralRe: Custom Control Styling Pin
Kevin Marois5-Dec-22 13:57
professionalKevin Marois5-Dec-22 13:57 
GeneralRe: Custom Control Styling Pin
Kevin Marois5-Dec-22 14:10
professionalKevin Marois5-Dec-22 14:10 
QuestionWPF .Net Core Relay Command with Parameters Pin
Kevin Marois1-Dec-22 13:50
professionalKevin Marois1-Dec-22 13:50 
QuestionForgot Password Pin
Kevin Marois1-Dec-22 13:06
professionalKevin Marois1-Dec-22 13:06 
AnswerRe: Forgot Password Pin
Richard Deeming1-Dec-22 22:10
mveRichard Deeming1-Dec-22 22:10 
QuestionWPF Core Hyperlkink Custom Control Pin
Kevin Marois29-Nov-22 16:29
professionalKevin Marois29-Nov-22 16:29 
AnswerRe: WPF Core Hyperlkink Custom Control Pin
Richard Deeming29-Nov-22 21:59
mveRichard Deeming29-Nov-22 21:59 
GeneralRe: WPF Core Hyperlkink Custom Control Pin
Kevin Marois30-Nov-22 5:46
professionalKevin Marois30-Nov-22 5:46 
GeneralRe: WPF Core Hyperlkink Custom Control Pin
Richard Deeming30-Nov-22 21:25
mveRichard Deeming30-Nov-22 21:25 
QuestionPath Images Pin
Kevin Marois29-Nov-22 14:57
professionalKevin Marois29-Nov-22 14:57 
AnswerRe: Path Images Pin
Richard Deeming29-Nov-22 23:46
mveRichard Deeming29-Nov-22 23:46 
QuestionDropShadowEffect Above & Below Pin
Kevin Marois29-Nov-22 14:30
professionalKevin Marois29-Nov-22 14:30 
AnswerRe: DropShadowEffect Above & Below Pin
Richard Deeming29-Nov-22 23:43
mveRichard Deeming29-Nov-22 23:43 
GeneralRe: DropShadowEffect Above & Below Pin
Kevin Marois30-Nov-22 5:32
professionalKevin Marois30-Nov-22 5:32 
GeneralRe: DropShadowEffect Above & Below Pin
Richard Deeming30-Nov-22 21:30
mveRichard Deeming30-Nov-22 21:30 
QuestionWhat's Wrong With This Style? Pin
Kevin Marois21-Nov-22 9:57
professionalKevin Marois21-Nov-22 9:57 
AnswerRe: What's Wrong With This Style? Pin
Gerry Schmitz21-Nov-22 10:17
mveGerry Schmitz21-Nov-22 10:17 
GeneralRe: What's Wrong With This Style? Pin
Kevin Marois21-Nov-22 11:44
professionalKevin Marois21-Nov-22 11:44 
QuestionStyle Question Pin
Kevin Marois20-Nov-22 10:30
professionalKevin Marois20-Nov-22 10:30 
AnswerRe: Style Question Pin
Richard Deeming20-Nov-22 22:37
mveRichard Deeming20-Nov-22 22:37 
GeneralRe: Style Question Pin
Kevin Marois21-Nov-22 8:05
professionalKevin Marois21-Nov-22 8:05 
Questionediting a WPF DataGrid Pin
pitwi13-Nov-22 9:08
pitwi13-Nov-22 9:08 
AnswerRe: editing a WPF DataGrid Pin
Gerry Schmitz15-Nov-22 7:38
mveGerry Schmitz15-Nov-22 7:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.