Click here to Skip to main content
16,016,477 members
Home / Discussions / WPF
   

WPF

 
QuestionBubbling Event Question Pin
Kevin Marois9-May-23 14:32
professionalKevin Marois9-May-23 14:32 
AnswerRe: Bubbling Event Question Pin
Gerry Schmitz12-May-23 5:28
mveGerry Schmitz12-May-23 5:28 
GeneralRe: Bubbling Event Question Pin
Kevin Marois12-May-23 5:35
professionalKevin Marois12-May-23 5:35 
GeneralRe: Bubbling Event Question Pin
Gerry Schmitz12-May-23 5:46
mveGerry Schmitz12-May-23 5:46 
GeneralRe: Bubbling Event Question Pin
Kevin Marois12-May-23 6:16
professionalKevin Marois12-May-23 6:16 
AnswerRe: Bubbling Event Question Pin
Kenneth Haugland14-May-23 9:55
mvaKenneth Haugland14-May-23 9:55 
GeneralRe: Bubbling Event Question Pin
Kevin Marois14-May-23 10:40
professionalKevin Marois14-May-23 10:40 
GeneralRe: Bubbling Event Question Pin
Kenneth Haugland14-May-23 11:06
mvaKenneth Haugland14-May-23 11:06 
You will need to install the NuGet:
NuGet Gallery | Microsoft.Xaml.Behaviors.Wpf 1.1.39[^]

Then create a class like this one:
public class ButtonAttatchment:Behavior<Button>
{

    protected override void OnAttached()
    {
        AssociatedObject.Click += AssociatedObject_Click;
    }

    protected override void OnDetaching()
    {
        AssociatedObject.Click -= AssociatedObject_Click;
    }


    private void AssociatedObject_Click(object sender, System.Windows.RoutedEventArgs e)
    {
        if (AssociatedObject != null)
        {
            ((ButtonAttatchment)sender).IsSpinning = !((ButtonAttatchment)sender).IsSpinning;
        }
    }

    public static readonly DependencyProperty IsSpinningProperty = DependencyProperty.Register("IsSpinning", typeof(bool),typeof(ButtonAttatchment), new UIPropertyMetadata(false));

    public bool IsSpinning
    {
        get => (bool)GetValue(IsSpinningProperty);
        set => SetValue(IsSpinningProperty, value);
    }

}


This basically creates a code-behind implementation that you could use to fix complicated binding issues.
GeneralRe: Bubbling Event Question Pin
Kevin Marois14-May-23 11:08
professionalKevin Marois14-May-23 11:08 
GeneralRe: Bubbling Event Question Pin
Kenneth Haugland14-May-23 11:19
mvaKenneth Haugland14-May-23 11:19 
GeneralRe: Bubbling Event Question Pin
Kevin Marois15-May-23 17:47
professionalKevin Marois15-May-23 17:47 
GeneralRe: Bubbling Event Question Pin
Kenneth Haugland15-May-23 18:46
mvaKenneth Haugland15-May-23 18:46 
GeneralRe: Bubbling Event Question Pin
Kevin Marois16-May-23 7:02
professionalKevin Marois16-May-23 7:02 
QuestionExpander Header Content Stretch Pin
Kevin Marois9-May-23 11:25
professionalKevin Marois9-May-23 11:25 
AnswerRe: Expander Header Content Stretch Pin
Richard Deeming9-May-23 21:48
mveRichard Deeming9-May-23 21:48 
GeneralRe: Expander Header Content Stretch Pin
Kevin Marois13-May-23 6:05
professionalKevin Marois13-May-23 6:05 
QuestionVB.NET WPF drag and drop for LISTBOX and TREEVIEWs..Anyone help with examples? Pin
Member 84579549-May-23 8:51
Member 84579549-May-23 8:51 
AnswerRe: VB.NET WPF drag and drop for LISTBOX and TREEVIEWs..Anyone help with examples? Pin
Richard MacCutchan9-May-23 10:14
mveRichard MacCutchan9-May-23 10:14 
AnswerRe: VB.NET WPF drag and drop for LISTBOX and TREEVIEWs..Anyone help with examples? Pin
Richard Deeming9-May-23 21:38
mveRichard Deeming9-May-23 21:38 
QuestionListBoxItem DataTemplate with HyperLink Problem Pin
Kevin Marois8-May-23 11:52
professionalKevin Marois8-May-23 11:52 
AnswerRe: ListBoxItem DataTemplate with HyperLink Problem Pin
Richard Deeming8-May-23 21:44
mveRichard Deeming8-May-23 21:44 
GeneralRe: ListBoxItem DataTemplate with HyperLink Problem Pin
Kevin Marois9-May-23 5:29
professionalKevin Marois9-May-23 5:29 
QuestionCustomControl Styling Question Pin
Kevin Marois4-May-23 17:22
professionalKevin Marois4-May-23 17:22 
AnswerRe: CustomControl Styling Question Pin
Pete O'Hanlon4-May-23 20:29
mvePete O'Hanlon4-May-23 20:29 
QuestionNavigationControl - Continued Pin
Kevin Marois2-May-23 14:49
professionalKevin Marois2-May-23 14:49 

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.