ERROR Setting Dependency Property

Developer
Aug 12, 2009 at 12:00 AM

ERROR Setting Dependency Property
Trying to set Column to 1

 

Boots -Width 1000 -Height 725 -WindowStartupLocation CenterScreen {
    GridPanel  -RowDefinitions @(
        RowDefinition -Height 400*
    ) -ColumnDefinitions @(
        ColumnDefinition -Width 300*
        ColumnDefinition -Width 300*
    ) {
        GroupBox -Header "Test" | Set-DependencyProperty "Grid.Column" 1 -Passthru
    }   
}   

 

Coordinator
Aug 12, 2009 at 1:27 AM
Edited Aug 12, 2009 at 1:44 AM

This is a bug. I’ve fixed it on my end and it will be in the next release: in the Set-DependencyProperty.ps1 script, delete line 76: $Class=””

75. } else {
76.    $Class = ""
77.     if("$Property".Contains(".")) { 
78.        $Class,$Property = "$Property".Split(".") 
79.     } 

 Once you’ve done that, you can use either syntax:  

 
Boots -Width 1000 -Height 725 -WindowStartupLocation CenterScreen { 
    GridPanel -RowDefinitions @(
        RowDefinition -Height 400*
    ) -ColumnDefinitions @(
        ColumnDefinition -Width 300*
        ColumnDefinition -Width 300*
    ) {
        GroupBox -Header "Test" | Set-DependencyProperty "Grid.Column" 1 -Passthru
    }
}


Boots -Width 1000 -Height 725 -WindowStartupLocation CenterScreen {
    GridPanel -RowDefinitions @(
        RowDefinition -Height 400*
    ) -ColumnDefinitions @(
        ColumnDefinition -Width 300*
        ColumnDefinition -Width 300*
    ) {
        GroupBox -Header "Test" { } -"Grid.Column" 1
    }
}

Note that to use the –“Grid.Column” parameter syntax, you have to first provide CONTENT (otherwise, “-Grid.Column” will be the content, because the way that works is that it pulls anything that’s “left over” and tries to parse them as dependency properties … but they’re not pre-defined parameters, so –“Grid.Column” is detected as a value, not a parameter name).