Click here to Skip to main content
15,562,223 members
Home / Discussions / WPF
   

WPF

 
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 
You're binding to a property defined in the code-behind of the control. But the DataContext isn't set anywhere, so it will be inherited from the parent. You'll need to use a TemplateBinding to bind to the control's properties:
XAML
<Style TargetType="{x:Type local:MaroisHyperlink}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate>
                <Border Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}">
                    <TextBlock>
                        <Hyperlink>
                             <TextBlock Text="{TemplateBinding LinkText}"/>
                             <i:Interaction.Triggers>
                                 <i:EventTrigger EventName="Click">
                                     <i:InvokeCommandAction Command="{TemplateBinding LinkClickedCommand}"/>
                                 </i:EventTrigger>
                             </i:Interaction.Triggers>
                        </Hyperlink>
                    </TextBlock>
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

The Interaction markup looks correct to me. I can't see any reason for that not to compile, unless the NuGet package reference isn't loading correctly. It may be worth raising an issue on the GitHub project for that library[^].



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

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 
QuestionWhat's Wrong With This Style? Pin
Kevin Marois21-Nov-22 10:57
professionalKevin Marois21-Nov-22 10:57 
AnswerRe: What's Wrong With This Style? Pin
Gerry Schmitz21-Nov-22 11:17
mveGerry Schmitz21-Nov-22 11:17 
GeneralRe: What's Wrong With This Style? Pin
Kevin Marois21-Nov-22 12:44
professionalKevin Marois21-Nov-22 12:44 
QuestionStyle Question Pin
Kevin Marois20-Nov-22 11:30
professionalKevin Marois20-Nov-22 11:30 
AnswerRe: Style Question Pin
Richard Deeming20-Nov-22 23:37
mveRichard Deeming20-Nov-22 23:37 
GeneralRe: Style Question Pin
Kevin Marois21-Nov-22 9:05
professionalKevin Marois21-Nov-22 9:05 
Questionediting a WPF DataGrid Pin
pitwi13-Nov-22 10:08
pitwi13-Nov-22 10:08 
AnswerRe: editing a WPF DataGrid Pin
Gerry Schmitz15-Nov-22 8:38
mveGerry Schmitz15-Nov-22 8:38 
QuestionCan I see the bounding box around WPF controls at runtime ? Pin
Maximilien27-Oct-22 4:16
Maximilien27-Oct-22 4:16 

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.