Posted 16 years ago
by Billy Jacobs
Version: 4.5.0486
Platform: .NET 3.5
Environment: Windows Vista (32-bit)

I have the following XAML. I am binding a command to the click event of a popup button. It does bind correctly because I get no binding error and the CanExecute fires when the control is loaded.
Note: The Command on line 3 fires correctly but not the command on line 5. Everything else works perfectly.Thanks,
Billy Jacobs
Note: The Command on line 3 fires correctly but not the command on line 5. Everything else works perfectly.
<DataTemplate x:Key="PhysicalFindingTemplate" >
<StackPanel Orientation="Horizontal">
<CheckBox Name="_physicalFindingCheckbox" Command="{Binding Path=DataContext.AddDeletePhysicalFindingCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:PhysicalExaminationControl}}}" CommandParameter="{Binding}" IsChecked="{Binding IsInUseForPatient, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Text=" " />
<shared:PopupButton PopupContent="{Binding}" Command="{Binding Path=DataContext.AddPhysicalFindingCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:PhysicalExaminationControl}}}" CommandParameter="{Binding}" VerticalContentAlignment="Center" Margin="0,0,10,0" x:Name="popupButtonContentXAML" Background="White" IsRounded="True" Grid.Column="1" Grid.Row="1" DisplayMode="Merged" Content="{Binding PhysicalFinding.Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
<shared:PopupButton.PopupContentTemplate>
<DataTemplate>
<shared:ResizableContentControl MinHeight="50" MinWidth="300" Padding="1">
<StackPanel Name="_modifiersStackPanel" Background="{DynamicResource VerticalBackgroundBrush}" RenderTransformOrigin="0.5,0.5"> <Label Margin="5,0,5,0" Foreground="White" FontWeight="Bold" HorizontalAlignment="Left" Height="28" Name="_preTextLabel" Width="120">Pre Text</Label>
<TextBox Margin="5,0,5,5" Name="_preText" Text="{Binding Path=PreText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<Label Margin="5,0,5,0" Foreground="White" FontWeight="Bold" HorizontalAlignment="Left" Height="28" Name="_postTextLabel" Width="120">Post Text</Label>
<TextBox Margin="5,0,5,5" Name="_postText" Text="{Binding Path=PostText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<ItemsControl ItemsSource="{Binding ModifierTypes}">
<ItemsControl.Resources>
<DataTemplate x:Key="SelectedItemTemplate">
<RadioButton IsThreeState="True" Command="{Binding Path=DataContext.AddDeletePhysicalFindingModifierCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:PhysicalExaminationControl}}}" CommandParameter="{Binding}" Content="{Binding Path=Modifier.Name}" IsChecked="{Binding Path=IsInUseForPatient}">
</RadioButton>
</DataTemplate>
</ItemsControl.Resources>
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel>
<Label Margin="5" FontWeight="Bold" Foreground="White" Content="{Binding Name}" />
<ListBox Margin="5" ItemsSource="{Binding Modifiers}" ItemTemplate="{StaticResource SelectedItemTemplate}" />
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</shared:ResizableContentControl>
</DataTemplate>
</shared:PopupButton.PopupContentTemplate>
</shared:PopupButton>
</StackPanel>
</DataTemplate>
Billy Jacobs