Click here to Skip to main content
15,035,866 members
Home / Discussions / WPF
   

WPF

 
PinnedHOW TO ANSWER A QUESTION PinPopular
Chris Maunder16-Jul-09 3:09
cofounderChris Maunder16-Jul-09 3:09 
PinnedHow to get an answer to your question PinPopular
Chris Maunder16-Jul-09 3:05
cofounderChris Maunder16-Jul-09 3:05 
QuestionStuck with Weird Exceptions Pin
Kevin Marois7-Sep-21 13:51
professionalKevin Marois7-Sep-21 13:51 
AnswerRe: Stuck with Weird Exceptions Pin
Richard Deeming7-Sep-21 21:28
mveRichard Deeming7-Sep-21 21:28 
GeneralRe: Stuck with Weird Exceptions Pin
Kevin Marois8-Sep-21 4:58
professionalKevin Marois8-Sep-21 4:58 
QuestionDisable ComboBox Hyperlinks Pin
Kevin Marois19-Aug-21 12:43
professionalKevin Marois19-Aug-21 12:43 
AnswerRe: Disable ComboBox Hyperlinks Pin
Richard Deeming19-Aug-21 21:35
mveRichard Deeming19-Aug-21 21:35 
GeneralRe: Disable ComboBox Hyperlinks Pin
Kevin Marois20-Aug-21 4:36
professionalKevin Marois20-Aug-21 4:36 
AnswerRe: Disable ComboBox Hyperlinks Pin
Matt T Heffron25-Aug-21 11:08
professionalMatt T Heffron25-Aug-21 11:08 
QuestionWPF DataGrid - Stretch Row Details Vertically Pin
Kevin Marois29-Jul-21 7:39
professionalKevin Marois29-Jul-21 7:39 
QuestionGet MainWindow from Executing Assembly Pin
Kevin Marois23-Jul-21 8:59
professionalKevin Marois23-Jul-21 8:59 
AnswerRe: Get MainWindow from Executing Assembly Pin
Richard Deeming27-Jul-21 23:18
mveRichard Deeming27-Jul-21 23:18 
GeneralRe: Get MainWindow from Executing Assembly Pin
Kevin Marois28-Jul-21 10:04
professionalKevin Marois28-Jul-21 10:04 
GeneralCan anyone recommend a free WPF editor control? Pin
Mike Hankey23-Jul-21 4:25
professionalMike Hankey23-Jul-21 4:25 
GeneralRe: Can anyone recommend a free WPF editor? Pin
Slacker00723-Jul-21 4:39
professionalSlacker00723-Jul-21 4:39 
GeneralRe: Can anyone recommend a free WPF editor? Pin
Richard Andrew x6423-Jul-21 4:45
professionalRichard Andrew x6423-Jul-21 4:45 
GeneralRe: Can anyone recommend a free WPF editor? Pin
Mike Hankey23-Jul-21 4:50
professionalMike Hankey23-Jul-21 4:50 
GeneralRe: Can anyone recommend a free WPF editor? Pin
Slacker00723-Jul-21 5:01
professionalSlacker00723-Jul-21 5:01 
GeneralRe: Can anyone recommend a free WPF editor control? Pin
Richard Deeming27-Jul-21 23:16
mveRichard Deeming27-Jul-21 23:16 
GeneralRe: Can anyone recommend a free WPF editor control? Pin
Mike Hankey28-Jul-21 2:05
professionalMike Hankey28-Jul-21 2:05 
QuestionInstalling Test Mode vs Production Mode Pin
Kevin Marois19-Jul-21 8:55
professionalKevin Marois19-Jul-21 8:55 
QuestionRouted Event Args Null Pin
Kevin Marois28-Jun-21 16:28
professionalKevin Marois28-Jun-21 16:28 
I have a user control with a custom Routed Event. I'm trying to pass event args:
public class NavigationViewFilterEventArgs : RoutedEventArgs
{
    public List<LookupEntity> StatusFilters { get; private set; }

    public List<LookupEntity> FilterItems { get; private set; }

    public NavigationViewFilterEventArgs(RoutedEvent e, List<LookupEntity> statusFilters, List<LookupEntity> filterItems) :
        base(e)
    {
        StatusFilters = statusFilters;
        FilterItems = filterItems;
    }
}
Here's the UserControl code behind:
public static readonly RoutedEvent FilterExecutedEvent =
            EventManager.RegisterRoutedEvent("FilterExecuted",
            RoutingStrategy.Bubble,
            typeof(RoutedEventHandler),
            typeof(NavigationView));

public event RoutedEventHandler FilterExecuted
{
    add { AddHandler(FilterExecutedEvent, value); }
    remove { RemoveHandler(FilterExecutedEvent, value); }
}

private void RaiseFilterExecutedEvent()
{
    var args = new NavigationViewFilterEventArgs(FilterExecutedEvent, StatusFilters, FilterItems);
    RaiseEvent(args);
}
The control is on the Main Window:
<ctrls:NavigationView Grid.Row="7" 
                        Caption="Companies"
                        StatusFilters="{Binding DataContext.CompanyStatusFilterItems, 
                                                ElementName=window, Mode=TwoWay, 
                                                UpdateSourceTrigger=PropertyChanged}">

    <i:Interaction.Triggers>
        <i:EventTrigger EventName="FilterExecuted">
            <i:InvokeCommandAction Command="{Binding DataContext.CompanyFilterExecutedEventCommand, 
                                                        ElementName=window}"/>
        </i:EventTrigger>
    </i:Interaction.Triggers>

</ctrls:NavigationView>
And finally the handler in the Main Window view model:
private ICommand _CompanyFilterExecutedEventCommand;
public ICommand CompanyFilterExecutedEventCommand
{
    get
    {
        if (_CompanyFilterExecutedEventCommand == null)
            _CompanyFilterExecutedEventCommand = new RelayCommand<NavigationViewFilterEventArgs>(p => CompanyFilterExecutedEventExecuted(p), p => CompanyFilterExecutedEventCanExecute());
        return _CompanyFilterExecutedEventCommand;
    }
}

private bool CompanyFilterExecutedEventCanExecute()
{
    return true;
}

private void CompanyFilterExecutedEventExecuted(NavigationViewFilterEventArgs args)
{
}

When I run this and click the button, the event reaches the Main Window VM's CompanyFilterExecutedEventExecuted method, but the param is always null.

I could use some help here.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.

AnswerRe: Routed Event Args Null Pin
Richard Deeming28-Jun-21 22:34
mveRichard Deeming28-Jun-21 22:34 
QuestionHow to change background color in combobox in code behind? Pin
Cường Nguyễn Văn 202123-Jun-21 6:56
MemberCường Nguyễn Văn 202123-Jun-21 6:56 
QuestionMake textbox fill up and resizie Pin
Acuena21-Jun-21 20:59
MemberAcuena21-Jun-21 20:59 

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.