Click here to Skip to main content
15,569,696 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: (newbie) I'm confused about ListView ItemSource bindings. Pin
Maximilien8-Dec-22 5:22
Maximilien8-Dec-22 5:22 
Questionfast directory infos for a lot of files Pin
pitwi6-Dec-22 3:14
pitwi6-Dec-22 3:14 
AnswerRe: fast directory infos for a lot of files Pin
pitwi6-Dec-22 3:29
pitwi6-Dec-22 3:29 
GeneralRe: fast directory infos for a lot of files Pin
Dave Kreskowiak6-Dec-22 6:40
mveDave Kreskowiak6-Dec-22 6:40 
AnswerRe: fast directory infos for a lot of files Pin
Richard Deeming6-Dec-22 3:51
mveRichard Deeming6-Dec-22 3:51 
GeneralRe: fast directory infos for a lot of files Pin
pitwi6-Dec-22 7:56
pitwi6-Dec-22 7:56 
QuestionCustom Control Styling Pin
Kevin Marois2-Dec-22 9:58
professionalKevin Marois2-Dec-22 9:58 
AnswerRe: Custom Control Styling Pin
Richard Deeming5-Dec-22 1:27
mveRichard Deeming5-Dec-22 1:27 
Kevin Marois wrote:
The Hyperlink.TextDecorations does not.
Firstly, it's Inline.TextDecorations, not Hyperlink.TextDecorations.
Inline.TextDecorations Property (System.Windows.Documents) | Microsoft Learn[^]

Setting that property on a parent element doesn't affect the Hyperlink, since it overrides the property in its default template. You either need to set the property explicitly on the Hyperlink:
XAML
<TextBlock>
    <Hyperlink TextDecorations="None">
or via a style:
XAML
<TextBlock>
    <Style TargetType="Hyperlink">
        <Setter Property="TextDecorations" Value="None" />
    </Style>
    <Hyperlink>
If you want to be able to override it when you use your control, you'll need a property to control it:
C#
public class MaroisHyperlink : ControlBase
{
    public static readonly DependencyProperty TextDecorationsProperty = Inline.TextDecorationsProperty.AddOwner(typeof(MaroisHyperlink));
    
    public TextDecorationCollection TextDecorations
    {
        get { return (TextDecorationCollection)GetValue(TextDecorationsProperty); }
        set { SetValue(TextDecorationsProperty, value); }
    }
and then bind the property in your template:
XAML
<Hyperlink TextDecorations="{TemplateBinding TextDecorations}">

Kevin Marois wrote:
None of the triggers at the bottom work.
A similar problem. The triggers should set the properties of your control, and the relevant properties of the Hyperlink should be bound to the properties on your control.
XAML
<Style.Triggers>
    <Trigger Property="IsMouseOver" Value="true">
        <Setter Property="Foreground" Value="{TemplateBinding HoverBrush}" />
        <Setter Property="TextDecorations" Value="Underline" />
    </Trigger>

    <Trigger Property="IsEnabled" Value="false">
        <Setter Property="Foreground" Value="Gray" />
        <Setter Property="TextDecorations" Value="None" />
    </Trigger>
</Style.Triggers>
XAML
<Hyperlink TextDecorations="{TemplateBinding TextDecorations}" Foreground="{TemplateBinding Foreground}>


Kevin Marois wrote:
The HoverBrush does not work
The HoverBrush property isn't used anywhere in your template. Changing the triggers as per the previous paragraph should resolve that, as well as the foreground brush styling.



"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:15
professionalKevin Marois5-Dec-22 13:15 
GeneralRe: Custom Control Styling Pin
Richard Deeming5-Dec-22 22:57
mveRichard Deeming5-Dec-22 22:57 
GeneralRe: Custom Control Styling Pin
Kevin Marois5-Dec-22 14:57
professionalKevin Marois5-Dec-22 14:57 
GeneralRe: Custom Control Styling Pin
Kevin Marois5-Dec-22 15:10
professionalKevin Marois5-Dec-22 15:10 
QuestionWPF .Net Core Relay Command with Parameters Pin
Kevin Marois1-Dec-22 14:50
professionalKevin Marois1-Dec-22 14:50 
QuestionForgot Password Pin
Kevin Marois1-Dec-22 14:06
professionalKevin Marois1-Dec-22 14:06 
AnswerRe: Forgot Password Pin
Richard Deeming1-Dec-22 23:10
mveRichard Deeming1-Dec-22 23:10 
QuestionWPF Core Hyperlkink Custom Control Pin
Kevin Marois29-Nov-22 17:29
professionalKevin Marois29-Nov-22 17:29 
AnswerRe: WPF Core Hyperlkink Custom Control Pin
Richard Deeming29-Nov-22 22:59
mveRichard Deeming29-Nov-22 22:59 
GeneralRe: WPF Core Hyperlkink Custom Control Pin
Kevin Marois30-Nov-22 6:46
professionalKevin Marois30-Nov-22 6:46 
GeneralRe: WPF Core Hyperlkink Custom Control Pin
Richard Deeming30-Nov-22 22:25
mveRichard Deeming30-Nov-22 22:25 
QuestionPath Images Pin
Kevin Marois29-Nov-22 15:57
professionalKevin Marois29-Nov-22 15:57 
AnswerRe: Path Images Pin
Richard Deeming30-Nov-22 0:46
mveRichard Deeming30-Nov-22 0:46 
QuestionDropShadowEffect Above & Below Pin
Kevin Marois29-Nov-22 15:30
professionalKevin Marois29-Nov-22 15:30 
AnswerRe: DropShadowEffect Above & Below Pin
Richard Deeming30-Nov-22 0:43
mveRichard Deeming30-Nov-22 0:43 
GeneralRe: DropShadowEffect Above & Below Pin
Kevin Marois30-Nov-22 6:32
professionalKevin Marois30-Nov-22 6:32 
GeneralRe: DropShadowEffect Above & Below Pin
Richard Deeming30-Nov-22 22:30
mveRichard Deeming30-Nov-22 22:30 

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.