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. Custom Control Binding Issue

Custom Control Binding Issue

Scheduled Pinned Locked Moved WPF
wpfhelpcsswcf
1 Posts 1 Posters 4 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

    I am creating a Custom Control. Everything is working fine but I have one binding problem that I can't seem to get past. Here's the control's XAML. Some of the XAML has been removed for brevity.

        <Setter Property="Template">
            <Setter.Value>
    
                <ControlTemplate TargetType="{x:Type local:NavigationList}">
    
                    <Expander Background="{TemplateBinding Background}"
                              BorderBrush="{TemplateBinding BorderBrush}"
                              BorderThickness="{TemplateBinding BorderThickness}"
                              IsExpanded="{TemplateBinding IsExpanded}"
                              HorizontalAlignment="{Binding HorizontalAlignment, RelativeSource={RelativeSource AncestorType=ContentPresenter}, Mode=OneWayToSource}">
    
                        <Grid>
    
                            <ListBox Grid.Row="1"
                                     ItemsSource="{Binding Items, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                     SelectedItem="{Binding SelectedItem, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                     BorderBrush="Transparent"
                                     HorizontalAlignment="Stretch">
    
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        
                                        <StackPanel Orientation="Horizontal">
    
                                            <Image Source="{Binding ItemImage, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
                                                   Width="16" 
                                                   Height="16" 
                                                   Margin="2"
                                                   HorizontalAlignment="Left" 
                                                   VerticalAlignment="Center"/>
    
                                            \*\*\*\*\*\* THE PROBLEM IS HERE \*\*\*\*\*\*
                                            <TextBlock M</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