views:

7

answers:

0

I am New to Silverlight. Question regarding firing the click event on a button embedded in a DomainUpDown control. Why does the only event I can get to fire (when click on the button) is the MouseLeftButtonDown on the DomainUpControl and it seemly ignores any Click event directly on the button. Incidentally, if a handler is setup, the GotFocus() event does fire for the button directly.

XAML:

<Grid x:Name="LayoutRoot" Background="White">
    <toolKitInput:DomainUpDown x:Name="SignsUpDown" ItemsSource="{Binding}" Width="180" Height="40" Background="Aqua" IsEditable="False" HorizontalAlignment="Left" VerticalAlignment="Top" MouseLeftButtonDown="SignsUpDown_MouseLeftButtonDown">
        <toolKitInput:DomainUpDown.ItemTemplate>
            <DataTemplate>

                    <StackPanel Orientation="Horizontal" MouseLeftButtonDown="StackPanel_MouseLeftButtonDown">
                        <Button Visibility="Visible" Name="btn" Content="TEST"   MouseLeftButtonDown="btn_MouseLeftButtonDown" Click="btn_Click" />
                    </StackPanel>

            </DataTemplate>
        </toolKitInput:DomainUpDown.ItemTemplate>
    </toolKitInput:DomainUpDown>
</Grid>

Code:

    /// <summary>
    /// Only event that fires for button onclick
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    private void SignsUpDown_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
    {
        string sTest = "";
    }

    private void btn_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
    {

        string sTest = "";
    }

    private void StackPanel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
    {
        string sTest = "";

    }


    // Initial Click event - never fires
    private void btn_Click(object sender, RoutedEventArgs e)
    {
        string sTest = "";
    }


}

}