Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

Problem with a DP PropertyChangedCallback not being invoked

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 01-31-2006   #1 (permalink)
Jason Dolinger
Guest


 

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
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Powershell starts but never exits when invoked from Wscript shell kanjasaha PowerShell 7 05-12-2008 12:14 PM
PS script behavior when invoked from cmd.exe Doug PowerShell 0 03-15-2007 11:17 AM
Tracebacks from code invoked via a Runspace Jason Mobarak PowerShell 0 03-02-2007 04:36 PM
move-mailbox cmdlet problem when invoked in c# code. =?Utf-8?B?UGFydGg=?= PowerShell 2 08-31-2006 11:43 PM


Vistax64.com 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 2005-2008

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 47 48 49 50 51