Autor Beitrag
mmp5
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 26



BeitragVerfasst: Fr 23.07.10 12:48 
Hallo,

wenn ich folgendes Konstrukt in XAML eingebe, wird mir einen Fehler angezeigt (Der PageContent-Werttyp wird von der Pages-Eigenschaft nicht unterstützt).
Wenn ich aber auf ausführen klick, dann funktionierts aber ohne Probleme.

ausblenden XML-Daten
1:
2:
3:
4:
5:
6:
7:
8:
9:
        <DocumentViewer Name="docView1" MouseLeftButtonUp="docView1_MouseLeftButtonUp">
            <FixedDocument MouseLeftButtonUp="FixedDocument_MouseLeftButtonUp">
                <PageContent>
                    <FixedPage Name="fp">
                        <TextBlock>aaaaaaaaaaaaaaaaaa</TextBlock>
                    </FixedPage>
                </PageContent>
            </FixedDocument>
        </DocumentViewer>


Also warum existiert dieses Problem, Pagecontent gehört doch zu FixedDocument, und das Funktioniert doch auch ...
Wie kann ich das Problem lösen, sodass die Fehlermeldung nicht mehr angezeigt wird und ich mein XAML Designer wieder sehe ??

Moderiert von user profile iconChristian S.: C#- durch XML-Tags ersetzt
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Fr 23.07.10 18:57 
Wenn ich mir mal die Google-Ergebnisse dazu angucke: Da kannste nix macht, das ist ein erstaunlich alter Bug des WPF-Designers.

Hier wird ein Workaround beschrieben:
Mark Wilson-Thomas hat folgendes geschrieben:
Hi @VS Hector VS and @TimStspry

You are quite correct - this problem does persist in the release candidate for Visual Studio 2010. Neither the Designer nor XAML Editor will load FixedDocuments; instead it will display the following error:

Error Message: Property 'Pages' does not support values of type 'PageContent'.
ausblenden XML-Daten
1:
2:
3:
4:
5:
6:
7:
8:
<DocumentViewer>
    <FixedDocument>
        <PageContent>
            <FixedPage>
            </FixedPage>
        </PageContent>
    </FixedDocument>
</DocumentViewer>


The workaround for this is to create the FixedDocument in code. It is possible to create XAML fragments in separate files, load them in code and inject them into the pages directly rather than edit them inline in the designer.

Because this workaround is straightforward and we believe the workaround to be the more common workflow in any case, we do not intend to include support for direct content in these scenarios in the designer in future versions.

If you wish to discuss this or any other Visual Studio WPF and Silverlight Designer issue further, please don't hesitate to contact me directly by email at mwthomas at microsoft dot com.

Regards
Mark Wilson-Thomas
Program Manager, WPF & Silverlight Designer, Visual Studio

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".