views:

25

answers:

1

I thought a simple problem like this should be no-brainer but after hours of searching I'm still not able to fix this one. I'm probably not thinking the WPF way because it looks I'm the only one on internet with this problem :)

Here's the problem. I'm having a fairly simple listview with a datatemplate (leaving some none-relevant code out)

Listview XAML

                            <StackPanel Orientation="Horizontal">
                                <StackPanel Orientation="Vertical">
                                    <TextBlock Text="{Binding Path=StartTime}" FontSize="14"/>
                                    <TextBlock Text="{Binding Path=EndTime}" FontSize="14"/>
                                          </StackPanel>
                                           <local:PatientListIconField PatientData="{Binding}"></local:PatientListIconField>
                                <TextBlock Margin="20,0,0,0" Text="{Binding Path=Message}" FontSize="14" Foreground="Green" FontWeight="Bold"/>
                              </StackPanel>

                        </DataTemplate>
                    </GridViewColumn.CellTemplate>
                </GridViewColumn>
                            </GridView>
                      </ListView.View>
            </ListView>

At line 6 I have this usercontrol PatientListIconField. It's a usercontrol which should decide depending on the patient data to render a specific image or a text label or nothing.

Here's the problem when I set a breakpoint at the setter of PatientData it's never hit.

Code-behind from the user control PatientListIconField

  public static DependencyProperty PatientDataProperty =  DependencyProperty.Register("PatientData",typeof(Patient),typeof(PatientListIconField));


   public Patient PatientData
    {
        get 
        { 
            return (Patient) GetValue(PatientDataProperty); 
        }
        set 
        { 
            SetValue(PatientDataProperty, value); 
        }
    }

Can somebody point me in the right direction to solve this one because I don't have a clue.

Thx in advance

A: 

I suspect there could be some binding error. Check the Output window in Visual Studio to ensure whether there is any binding error exist.

The following post could be helpful as well. http://stackoverflow.com/questions/337023/how-to-detect-broken-wpf-data-binding

HTH

Avatar
Hey Avatar,Thx for the feedback.I don't think it's a binding problem because the binding on texboxes works perfect.Anyway I replaced the listview with a scrolviewer and stackpanel
Kris