Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - Problem with a DP PropertyChangedCallback not being invoked

 
 
Old 01-31-2006   #1 (permalink)
Jason Dolinger


 
 

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:
<ccataGrid 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 SpecsSystem Spec
 

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


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46