![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | Problem with a DP PropertyChangedCallback not being invoked Hi all, I was wondering if someone could take a quick look at this sample. I have a custom control, which has a single dependency property. When you set this dependency property in XAML upon declaration of the control, I need to set some properties on the child elements of this control (specifically it's a child grid which has it's Visibility property changed). I've set up a PropertyChangedCallback on this property to make the change to the corresponding internal properties when the DP is set. Here are the relevant snippets: // the custom control class definition: public partial class DataGrid : ItemsControl { // Dependency Properties public static readonly DependencyProperty ShowRowHeadersProperty = DependencyProperty.Register("ShowRowHeaders", typeof(bool), typeof(DataGrid), new PropertyMetadata( new PropertyChangedCallback(ShowRowHeadersPropChanged))); .... public static void ShowRowHeadersPropChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { Console.WriteLine("In ShowRowHeadersPropChanged()"); bool value = (bool) e.NewValue; ((DataGrid) d).rowHeaderGrid.Visibility = value ? Visibility.Visible : Visibility.Hidden; } and the XAML that creates the DataGrid in a window: <cc ataGrid Grid.Row="1" x:Name="OrderGrid" ShowRowHeaders="False" />For some reason, the ShowRowHeadersPropChanged callback in never invoke when I run this code. I've tried this exact same other pattern in another example to test it and the callback does get invoked. Can any MS folks have an idea on why the Callback might not be invoked? Thanks, any help is appreciated! Jason |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| log4net: Custom appender not being invoked | .NET General | |||
| PS script behavior when invoked from cmd.exe | PowerShell | |||
| Tracebacks from code invoked via a Runspace | PowerShell | |||
| move-mailbox cmdlet problem when invoked in c# code. | PowerShell | |||