{"id":6276,"date":"2024-09-29T09:45:20","date_gmt":"2024-09-29T07:45:20","guid":{"rendered":"https:\/\/ekiwi.de\/?p=6276"},"modified":"2024-09-29T09:45:20","modified_gmt":"2024-09-29T07:45:20","slug":"mache-xaml-page-scrollable","status":"publish","type":"post","link":"https:\/\/ekiwi.de\/index.php\/6276\/mache-xaml-page-scrollable\/","title":{"rendered":"Mache XAML Page scrollable"},"content":{"rendered":"<p>Wer in Visual Studio XAML-Projekte bearbeitet, wird gelegentlich auch xaml-Pages verwenden.<\/p>\n<p>XAML-Pages sind \u00e4hnlich wie XAML-Windows oder UserControls, nur mit dem Unterschied, dass diese bereits eine gute M\u00f6glichkeit der Navigation (vor und zur\u00fcck) mitbringen.<\/p>\n<p>Ist der Inhalt der Page aber gr\u00f6\u00dfer als die H\u00f6he oder Breite der Page selbst, dann verschwinden Inhaltselemente oder sind abgeschnitten. Deswegen sollte in solchen F\u00e4llen die xaml-Page scrollbar sein, also mit Scrollbalken versehen sein.<\/p>\n<p>Dies erreicht man, indem man den gesamten Content der Page innerhalb eines &#8222;<strong>ScrollViewer<\/strong>&#8220; packt. Beim ScrollViewer kann man noch \u00fcber die Parameter <em>VerticalScrollBarVisibility<\/em> und <em>HorizontalScrollBarVisibility<\/em> defineren, ob die senkrechte oder horizontale Scrollbar angezeigt werden soll. Man kann die Parameter auch auf &#8222;<em>Auto<\/em>&#8220; setzen. In diesem Fall wird die jeweilige Scrollbar nur angezeigt, wenn der Inhalt gr\u00f6\u00dfer als das Page-Fenster ist.<\/p>\n<p>Der <strong>Code<\/strong> sieht dann so aus:<\/p>\n<pre><code><span style=\"color: #993366;\"><span style=\"color: #3366ff;\">&lt;<\/span>Page<\/span>\r\n    <span style=\"color: #ff0000;\">xmlns<\/span><span style=\"color: #3366ff;\">=\"http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\/presentation\"<\/span>\r\n    <span style=\"color: #ff0000;\">xmlns<\/span><span style=\"color: #3366ff;\">:<\/span><span style=\"color: #ff0000;\">x<\/span><span style=\"color: #3366ff;\">=\"http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\"<\/span>\r\n    <span style=\"color: #ff0000;\">xmlns<\/span><span style=\"color: #3366ff;\">:<\/span><span style=\"color: #ff0000;\">mc<\/span><span style=\"color: #3366ff;\">=\"http:\/\/schemas.openxmlformats.org\/markup-compatibility\/2006\"<\/span>\r\n    <span style=\"color: #ff0000;\">xmlns<\/span><span style=\"color: #3366ff;\">:<\/span><span style=\"color: #ff0000;\">d<\/span><span style=\"color: #3366ff;\">=\"http:\/\/schemas.microsoft.com\/expression\/blend\/2008\"<\/span>\r\n    <span style=\"color: #ff0000;\">mc<\/span><span style=\"color: #3366ff;\">:<\/span><span style=\"color: #ff0000;\">Ignorable<\/span><span style=\"color: #3366ff;\">=\"d\"<\/span> <span style=\"color: #ff0000;\">d<\/span><span style=\"color: #3366ff;\">:DesignHeight=\"600\"<\/span> <span style=\"color: #ff0000;\">d<\/span><span style=\"color: #3366ff;\">:DesignWidth=\"800\"<\/span>\r\n    <span style=\"color: #ff0000;\">x<\/span><span style=\"color: #3366ff;\">:<\/span><span style=\"color: #ff0000;\">Name<\/span><span style=\"color: #3366ff;\">=\"PgCompanyData\" Title=\"PageTitle\"&gt;<\/span>\r\n    <strong><span style=\"color: #993366;\"><span style=\"color: #3366ff;\">&lt;<\/span>ScrollViewer<\/span> <span style=\"color: #ff0000;\">VerticalScrollBarVisibility<\/span><span style=\"color: #3366ff;\">=\"Auto\"<\/span> <span style=\"color: #ff0000;\">HorizontalScrollBarVisibility<\/span><span style=\"color: #3366ff;\">=\"Auto\"&gt;<\/span><\/strong>\r\n        <span style=\"color: #3366ff;\">&lt;<\/span><span style=\"color: #993366;\">Grid<\/span><span style=\"color: #3366ff;\">&gt;<\/span>\r\n            <span style=\"color: #339966;\">&lt;!-- GridDefinitions and further content--&gt;<\/span>\r\n        <span style=\"color: #3366ff;\">&lt;<\/span><span style=\"color: #993366;\"><span style=\"color: #3366ff;\">\/<\/span>Grid<span style=\"color: #3366ff;\">&gt;<\/span><\/span>\r\n    <strong><span style=\"color: #993366;\"><span style=\"color: #3366ff;\">&lt;\/<\/span>ScrollViewer<span style=\"color: #3366ff;\">&gt;<\/span><\/span><\/strong>\r\n<span style=\"color: #993366;\"><span style=\"color: #3366ff;\">&lt;\/<\/span>Page<span style=\"color: #3366ff;\">&gt;\r\n<\/span><\/span><\/code><\/pre>","protected":false},"excerpt":{"rendered":"<p>Wer in Visual Studio XAML-Projekte bearbeitet, wird gelegentlich auch xaml-Pages verwenden. XAML-Pages sind \u00e4hnlich wie XAML-Windows oder UserControls, nur mit<\/p>\n","protected":false},"author":2,"featured_media":5726,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[13],"tags":[190,192,136,191],"class_list":["post-6276","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programmierung","tag-c","tag-csharp","tag-programmieren","tag-visual-studio"],"_links":{"self":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/posts\/6276","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/comments?post=6276"}],"version-history":[{"count":0,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/posts\/6276\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/media\/5726"}],"wp:attachment":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/media?parent=6276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/categories?post=6276"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/tags?post=6276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}