Click here to Skip to main content
15,395,360 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 
QuestionWhat is the most common MVVM framework used today? Pin
Code4Ever21-Jul-22 7:26
MemberCode4Ever21-Jul-22 7:26 
AnswerRe: What is the most common MVVM framework used today? Pin
Pete O'Hanlon21-Jul-22 21:21
mvaPete O'Hanlon21-Jul-22 21:21 
AnswerRe: What is the most common MVVM framework used today? Pin
Richard Deeming21-Jul-22 21:22
mveRichard Deeming21-Jul-22 21:22 
AnswerRe: What is the most common MVVM framework used today? Pin
Gerry Schmitz22-Jul-22 5:10
mveGerry Schmitz22-Jul-22 5:10 
GeneralRe: What is the most common MVVM framework used today? Pin
Pete O'Hanlon24-Jul-22 11:32
mvaPete O'Hanlon24-Jul-22 11:32 
GeneralRe: What is the most common MVVM framework used today? Pin
Gerry Schmitz25-Jul-22 20:43
mveGerry Schmitz25-Jul-22 20:43 
GeneralRe: What is the most common MVVM framework used today? Pin
Pete O'Hanlon25-Jul-22 21:30
mvaPete O'Hanlon25-Jul-22 21:30 
QuestionIs it possible to do event handling in the ViewModel? Pin
Code4Ever16-Jul-22 6:39
MemberCode4Ever16-Jul-22 6:39 
AnswerRe: Is it possible to do event handling in the ViewModel? Pin
Gerry Schmitz17-Jul-22 6:06
mveGerry Schmitz17-Jul-22 6:06 
QuestionDICOM TAGS Pin
harol espinosa26-Jun-22 5:20
Memberharol espinosa26-Jun-22 5:20 
AnswerRe: DICOM TAGS Pin
Dave Kreskowiak26-Jun-22 6:13
mveDave Kreskowiak26-Jun-22 6:13 
QuestionDevelopment Pin
User 156237373-Jun-22 10:46
MemberUser 156237373-Jun-22 10:46 
AnswerRe: Development Pin
Gerry Schmitz4-Jun-22 10:35
mveGerry Schmitz4-Jun-22 10:35 
GeneralRe: Development Pin
User 156237376-Jun-22 4:22
MemberUser 156237376-Jun-22 4:22 
QuestionTreeView in ControlTemplate - Handling Item Expanded Pin
Kevin Marois27-Apr-22 9:46
professionalKevin Marois27-Apr-22 9:46 
I am creating a Custom Control and in the control template I have a TreeView class in it.
<Style TargetType="{x:Type local:MyControl}">

    <Setter Property="Template">

        <Setter.Value>

            <ControlTemplate TargetType="{x:Type local:MyControl}">

                <Border Background="{TemplateBinding Background}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}">

                    <TreeView ItemsSource="{Binding TreeDataItems, RelativeSource={RelativeSource TemplatedParent}}">

                        <TreeView.Resources>
                            <HierarchicalDataTemplate DataType="{x:Type local:TreeItem}" ItemsSource="{Binding Children}">
                                <TextBlock Text="{Binding Path=Caption}" />
                            </HierarchicalDataTemplate>
                        </TreeView.Resources>

                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="TreeViewItem.Expanded">
                                <i:InvokeCommandAction Command="{Binding TreeItemExpandedCommand, RelativeSource={RelativeSource TemplatedParent}}"
                                                    CommandParameter="{Binding}">

                                </i:InvokeCommandAction>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>

                    </TreeView>
                </Border>

            </ControlTemplate>

        </Setter.Value>

    </Setter>

</Style>
In the code behind I have
private ICommand _TreeItemExpandedCommand;
public ICommand TreeItemExpandedCommand
{
    get
    {
        if (_TreeItemExpandedCommand == null)
            _TreeItemExpandedCommand = new RelayCommand<object>(p => TreeItemExpandedExecuted(p));
        return _TreeItemExpandedCommand;
    }
}

private void TreeItemExpandedExecuted(object args)
{
}

When I expand a node nothing happens. There are no binding errors, and the Command's getter fires when it starts, but the TreeItemExpandedExecuted never fires.

I tried using the event itself:
<TreeView TreeViewItem.Expanded="TreeViewItem_Expanded">
    ...
</TreeView/>

and

 private void TreeViewItem_Expanded(object sender, RoutedEventArgs e)
    {
        TreeViewItem tvi = e.OriginalSource as TreeViewItem;
        if (tvi != null)
        {
          // Do something
        }
    }
But still nothing.

I'm guessing this has something to do with this all being in a ControlTemplate. Anyone see what's wrong here?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.

QuestionWPF DataGridCell Binding Problem Pin
Kevin Marois7-Apr-22 14:39
professionalKevin Marois7-Apr-22 14:39 
AnswerRe: WPF DataGridCell Binding Prolem Pin
Richard Deeming7-Apr-22 21:36
mveRichard Deeming7-Apr-22 21:36 
GeneralRe: WPF DataGridCell Binding Prolem Pin
Kevin Marois8-Apr-22 5:38
professionalKevin Marois8-Apr-22 5:38 
GeneralRe: WPF DataGridCell Binding Prolem Pin
Kevin Marois13-Apr-22 7:59
professionalKevin Marois13-Apr-22 7:59 
GeneralRe: WPF DataGridCell Binding Prolem Pin
Richard Deeming18-Apr-22 21:45
mveRichard Deeming18-Apr-22 21:45 
QuestionCode Behind Data Grid Style Issue Pin
Kevin Marois6-Apr-22 15:01
professionalKevin Marois6-Apr-22 15:01 
SuggestionRe: Code Behind Data Grid Style Issue Pin
Richard Deeming6-Apr-22 22:37
mveRichard Deeming6-Apr-22 22:37 
GeneralRe: Code Behind Data Grid Style Issue Pin
Kevin Marois7-Apr-22 5:25
professionalKevin Marois7-Apr-22 5:25 

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.