none
Problem bei Databinding an eine Page RRS feed

  • Frage

  • Ich habe eine Page folgendermaßen eingebaut:

                            <Grid>
                                <Frame Height="258" Margin="0,0,0,28" >
                                    <Frame.Content>
                                        <p:ColorSelectPage IsAlphaVisible="{Binding ElementName=checkBoxCSP_IsAlphaVisible, Path=IsChecked}"
                                                           IsPreviewVisible="{Binding ElementName=checkBoxCSP_IsPreviewVisible, Path=IsChecked}"/>
                                    </Frame.Content>
                                </Frame>
                                <CheckBox Content="IsAlphaVisible" Height="16" HorizontalAlignment="Left" Margin="6,264,0,0" Name="checkBoxCSP_IsAlphaVisible" VerticalAlignment="Top" />
                                <CheckBox Content="IsPreviewVisible" Height="16" HorizontalAlignment="Left" Margin="157,264,0,0" Name="checkBoxCSP_IsPreviewVisible" VerticalAlignment="Top" IsChecked="True" />
                            </Grid>                                     


    In der Page sind 2 DependencyProperties:

            private static readonly DependencyProperty IsAlphaVisibleProperty = DependencyProperty.Register("IsAlphaVisible", typeof(bool),
                typeof(ColorSelectPage), new PropertyMetadata(false, OnIsAlphaVisibleChanged));
            private static void OnIsAlphaVisibleChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
            {
                ColorSelectPage csp = (ColorSelectPage)dependencyObject;
                //Gekürtzt...
            }
    
            [Category("Common")]
            public bool IsAlphaVisible
            {
                get
                {
                    return (bool)GetValue(IsAlphaVisibleProperty);
                }
                set
                {
                    SetValue(IsAlphaVisibleProperty, value);
                }
            }
    
            private static readonly DependencyProperty IsPreviewVisibleProperty = DependencyProperty.Register("IsPreviewVisible", typeof(bool),
                typeof(ColorSelectPage), new PropertyMetadata(true, OnIsPreviewVisibleChanged));
            private static void OnIsPreviewVisibleChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
            {
                ColorSelectPage csp = (ColorSelectPage)dependencyObject;
    //Gekürtzt... } [Category("Common")] public bool IsPreviewVisible { get { return (bool)GetValue(IsPreviewVisibleProperty); } set { SetValue(IsPreviewVisibleProperty, value); } }

    Wenn ich nun eine Checkbox aktivier /Deaktiviere, passiert nichts :=(.

    Warum nicht? Ist Datenbindung mit Pages etwa icht möglich?

    Freitag, 13. Juli 2012 15:09