Click here to Skip to main content
15,886,137 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: WPF Custom Control & User Control Pin
Gerry Schmitz31-Dec-22 10:58
mveGerry Schmitz31-Dec-22 10:58 
GeneralRe: WPF Custom Control & User Control Pin
Kevin Marois31-Dec-22 14:59
professionalKevin Marois31-Dec-22 14:59 
GeneralRe: WPF Custom Control & User Control Pin
Gerry Schmitz1-Jan-23 2:59
mveGerry Schmitz1-Jan-23 2:59 
GeneralRe: WPF Custom Control & User Control Pin
Kevin Marois1-Jan-23 14:27
professionalKevin Marois1-Jan-23 14:27 
QuestionPath Image Pin
Kevin Marois28-Dec-22 16:27
professionalKevin Marois28-Dec-22 16:27 
AnswerRe: Path Image Pin
Gerry Schmitz28-Dec-22 17:02
mveGerry Schmitz28-Dec-22 17:02 
GeneralRe: Path Image Pin
Kevin Marois28-Dec-22 18:53
professionalKevin Marois28-Dec-22 18:53 
GeneralRe: Path Image Pin
Gerry Schmitz29-Dec-22 4:40
mveGerry Schmitz29-Dec-22 4:40 
QuestionWPF editor is duplicating my image files Pin
tbenner196016-Dec-22 4:54
tbenner196016-Dec-22 4:54 
AnswerRe: WPF editor is duplicating my image files Pin
Dave Kreskowiak16-Dec-22 11:32
mveDave Kreskowiak16-Dec-22 11:32 
GeneralRe: WPF editor is duplicating my image files Pin
tbenner196017-Dec-22 3:27
tbenner196017-Dec-22 3:27 
GeneralRe: WPF editor is duplicating my image files Pin
Dave Kreskowiak17-Dec-22 5:25
mveDave Kreskowiak17-Dec-22 5:25 
QuestionCustomizing the TabPanel section of the TabControl (simple solution found) Pin
Maximilien15-Dec-22 4:33
Maximilien15-Dec-22 4:33 
QuestionWPF .Net Core Dependency Injection & View Models Pin
Kevin Marois14-Dec-22 12:06
professionalKevin Marois14-Dec-22 12:06 
AnswerRe: WPF .Net Core Dependency Injection & View Models Pin
Graeme_Grant31-Dec-22 3:15
mvaGraeme_Grant31-Dec-22 3:15 
Question(ANSWERED) (newbie) I'm confused about ListView ItemSource bindings. Pin
Maximilien8-Dec-22 2:42
Maximilien8-Dec-22 2:42 
AnswerRe: (newbie) I'm confused about ListView ItemSource bindings. Pin
Richard Deeming8-Dec-22 3:58
mveRichard Deeming8-Dec-22 3:58 
GeneralRe: (newbie) I'm confused about ListView ItemSource bindings. Pin
Maximilien8-Dec-22 4:22
Maximilien8-Dec-22 4:22 
Questionfast directory infos for a lot of files Pin
pitwi6-Dec-22 2:14
pitwi6-Dec-22 2:14 
AnswerRe: fast directory infos for a lot of files Pin
pitwi6-Dec-22 2:29
pitwi6-Dec-22 2:29 
GeneralRe: fast directory infos for a lot of files Pin
Dave Kreskowiak6-Dec-22 5:40
mveDave Kreskowiak6-Dec-22 5:40 
AnswerRe: fast directory infos for a lot of files Pin
Richard Deeming6-Dec-22 2:51
mveRichard Deeming6-Dec-22 2:51 
GeneralRe: fast directory infos for a lot of files Pin
pitwi6-Dec-22 6:56
pitwi6-Dec-22 6:56 
QuestionCustom Control Styling Pin
Kevin Marois2-Dec-22 8:58
professionalKevin Marois2-Dec-22 8:58 
AnswerRe: Custom Control Styling Pin
Richard Deeming5-Dec-22 0:27
mveRichard Deeming5-Dec-22 0: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

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.