Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. Add Handler For Child Control Event

Add Handler For Child Control Event

Scheduled Pinned Locked Moved WPF
csswpfwcf
1 Posts 1 Posters 30 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kevin Marois
    wrote on last edited by
    #1

    This is a bit long, but it should be easy to understand... I created a simple navigation CustomControl, with Today, Previous, and Next buttons. It has a routed event called NavigationSelectedEvent. The event is called from the three button's comands: Style

        <Setter Property="Template">
    
            <Setter.Value>
    
                <ControlTemplate TargetType="{x:Type views:NavigationView}">
    
                    <Border x:Name="border"
                            Background="{StaticResource brushActiveBack}" 
                            BorderBrush="{StaticResource brushPeriodBorder}"
                            BorderThickness="1,1,0,0"
                            Margin="{Binding Margin, RelativeSource={RelativeSource TemplatedParent}}"
                            Padding="{Binding Padding, RelativeSource={RelativeSource TemplatedParent}}">
    
                        <Grid>
    
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
    
                            <Button Grid.Column="0"
                                    Content="Today"
                                    Height="28"
                                    Width="85"
                                    Margin="2,2,2,2"
                                    Command="{Binding NavigateTodayCommand, RelativeSource={RelativeSource TemplatedParent}}"/>
    
                            <Button Grid.Column="1"
                                    Content="&lt;"
                                    Height="28"
                                    Width="85"
                                    Margin="0,2,2,2"
                                    Command="{Binding NavigatePreviousCommand, RelativeSource={RelativeSource TemplatedParent}}"/>
    
                            <Button Grid.Column="2"
                                    Content="&gt;"
                                    Height="28"
                                    Width="85"
                                    Margin="0,2,2,2"
                                    Command="{Binding NavigateNextCommand, RelativeSource={RelativeSource TemplatedParent}}"/>
    
                        </Grid>
    
                    </Border>
    
                </ControlTemplat</x-turndown>
    
    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups