0

Ok I have a custom TreeListView that inherits from TreeView and has some columns.

I have custom objects in my application with two text properties; KeyValue and Description. I'm trying to bind textboxes in the columns to these properties which works great on the initial load, however not so good when I want to change them. It works exactly as it's supposed to (changing the values on the base objects) for top level items, but for anything below that, it doesn't change the underlying values when I change the textbox value. I'm pretty new to WPF so sorry if this is basic but I have searched quite a while and can't find an answer that seems to work for me.

The XAML for the TreeListView is:

<r:TreeListView Name="TLV_Main" Margin="0,0,0,41" ItemsSource="{Binding Keynotes}" Style="{StaticResource TLV_Standard}">
    <r:TreeListView.Columns>
        <GridViewColumn Header="Key" >
            <GridViewColumn.CellTemplate>
                <DataTemplate>
                    <TextBox Text="{Binding Path=KeyValue, Mode=TwoWay}" ContextMenu="{StaticResource Ctx_All}" ></TextBox>
                </DataTemplate>
            </GridViewColumn.CellTemplate>
        </GridViewColumn>
        <GridViewColumn Header="Description" Width="{Binding ElementName=TLV_Main, Path=ActualWidth, Converter={StaticResource DescriptionColumnConverter}}">
            <GridViewColumn.CellTemplate>
                <DataTemplate>
                    <TextBox Text="{Binding Path=Description, Mode=TwoWay}" TextWrapping="Wrap"></TextBox>
                </DataTemplate>
            </GridViewColumn.CellTemplate>
        </GridViewColumn>
        <GridViewColumn Width="30">
            <GridViewColumn.Header>
                <Image Source="pack://application:,,,/Resources/Icon_Comment.png" SnapsToDevicePixels="False" Stretch="None"></Image>
            </GridViewColumn.Header>
            <GridViewColumn.CellTemplate>
                <DataTemplate>
                    <Image Source="pack://application:,,,/Resources/Icon_Comment.png" SnapsToDevicePixels="False" Stretch="None" Visibility="{Binding Converter={StaticResource BoolToVisibility}, Path=HasActiveComments}" MouseLeftButtonUp="CommentClick"></Image>
                </DataTemplate>
            </GridViewColumn.CellTemplate>
        </GridViewColumn>
        <GridViewColumn Width="30">
            <GridViewColumn.Header>
                <Image Source="pack://application:,,,/Resources/Icon_Link.png" SnapsToDevicePixels="False" Stretch="None"></Image>
            </GridViewColumn.Header>
            <GridViewColumn.CellTemplate>
                <DataTemplate>
                    <Image Source="pack://application:,,,/Resources/Icon_Link.png" SnapsToDevicePixels="False" Stretch="None" Visibility="{Binding Converter={StaticResource BoolToVisibility}, Path=HasLinks}" MouseLeftButtonUp="LinkClick"></Image>
                </DataTemplate>
            </GridViewColumn.CellTemplate>
        </GridViewColumn>
    </r:TreeListView.Columns>
    <r:TreeListView.ItemTemplate>
        <HierarchicalDataTemplate ItemsSource="{Binding ChildNotes}">
        </HierarchicalDataTemplate>
    </r:TreeListView.ItemTemplate>
</r:TreeListView>

Can anyone see why this wouldn't work right?

4

0 回答 0