微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

无法获得初始规模为Windows Phone 7工作

我有一个webbrowser在我的winphone 7应用程序来显示几个网页,其中包含两个button,左边和右边的标题在中间,gridview下方gridview和几个图片

我尝试了几乎所有以下的组合:

<!--Meta name="viewport" content="target-densitydpi=device-dpi; width=device-width; initial-scale=0.35; user-scalable=yes" /--> <!--Meta name="mobileoptimized" content="0" /--> <!--Meta name="viewport" content="width=480; initial-scale=5.0; user-scalable=yes;" id="ViewPort" runat="server" /> <!--Meta http-equiv="Content-Type" content="application/vnd.wap.xhtml+xml; charset=utf-8" /--> <!--Meta name="HandheldFriendly" content="true" /--> <!--Meta name="apple-mobile-web-app-capable" content="yes" /-->

如果我使用设备宽度,我的gridview中的最后几列在屏幕外,试图用初始缩放比例正确地缩放它什么也不做。 如果我使用一个设置的宽度,例如320或640,gridview会变小(小于屏幕宽度),并且初始缩放再次不起作用。

有任何想法吗 ?

aspx源添加

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="iDetailled.aspx.cs" Inherits="iDetailled" Title="test" EnableEventValidation="false" %> <%@ Register assembly="System.Web.DataVisualization,Version=3.5.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.DataVisualization.Charting" tagprefix="asp" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <!--Meta name="viewport" content="target-densitydpi=device-dpi; width=device-width; initial-scale=0.35; user-scalable=yes" /--> <!--Meta name="mobileoptimized" content="0" /--> <Meta name="viewport" content="width=device-width,initial-scale=0.9,user-scalable=yes" id="ViewPort" runat="server" /> <!--Meta http-equiv="Content-Type" content="application/vnd.wap.xhtml+xml; charset=utf-8" /--> <!--Meta name="HandheldFriendly" content="true" /--> <!--Meta name="apple-mobile-web-app-capable" content="yes" /--> <title></title> <script type="text/javascript"> function CallMe() { javascript: history.go(-1); } </script> </head> <link rel="stylesheet" type="text/css" href="stylesheet.css" media="screen"/> <body class="GradientBackground3" bgcolor="#CFD1D2"> <form id="form1" runat="server" > <asp:ScriptManager ID="ScriptManager1" runat="server" EnableHistory="True" onnavigate="ScriptManager1_Navigate"> </asp:ScriptManager> <div align="center"> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:MultiView ID="MultiView1" runat="server" onactiveviewchanged="MultiView1_ActiveViewChanged" > <asp:View ID="View1" runat="server"> <br /> <asp:Panel ID="Panel2" runat="server" Width="90%" > <table align="center" width="100%"> <tr> <td align="left" > <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Images/min2.png" Height="48px" onclick="ImageButton1_Click" Width="48px" /> </td> <td> <table align="center" > <tr align="center"> <td> <asp:Label ID="Label2" runat="server" Font-Bold="True" Font-Size="Large" Text="Turnover by day"></asp:Label> </td> </tr> <tr align="center"> <td> <asp:Label ID="Label4" runat="server" Text="Label"></asp:Label> </td> </tr> </table> </td> <td align="right"> <asp:ImageButton ID="ImageButton2" runat="server" Height="48px" ImageUrl="~/Images/plus2.png" onclick="ImageButton2_Click" Width="48px" /> </td> </tr> </table> </asp:Panel> <br /> <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" CellPadding="4" DataSourceID="sqlDataSourceDag" ForeColor="#333333" GridLines="Vertical" onrowcreated="GridView2_RowCreated" onselectedindexchanged="GridView2_SelectedindexChanged" onrowdatabound="GridView2_RowDataBound" EmptyDataText="No data to display" > <RowStyle BackColor="#F7F6F3" ForeColor="#333333" /> <Columns> <asp:CommandField ShowSelectButton="True" /> <asp:BoundField datafield="TYBusinessDate" DataFormatString="{0:dd/MM}" HeaderText="This Year" ReadOnly="True" SortExpression="TYBusinessDate"> <HeaderStyle VerticalAlign="Bottom" BorderColor="White" BorderSolid" BorderWidth="1px"/> </asp:BoundField> <asp:BoundField datafield="LYBusinessDate" DataFormatString="{0:dd/MM}" HeaderText="Last Year" ReadOnly="True" SortExpression="LYBusinessDate"> <HeaderStyle VerticalAlign="Bottom" BorderColor="White" BorderSolid" BorderWidth="1px"/> </asp:BoundField> <asp:BoundField datafield="Day" HeaderText="Day" ReadOnly="True" SortExpression="Day"> <HeaderStyle HorizontalAlign="Center" VerticalAlign="Bottom" BorderColor="White" BorderSolid" BorderWidth="1px"/> <ItemStyle HorizontalAlign="Center" /> </asp:BoundField> <asp:BoundField datafield="TYTurnoverAmt" DataFormatString="{0:F0}" HeaderText="This Year" ReadOnly="True" SortExpression="TYTurnoverAmt"> <HeaderStyle HorizontalAlign="Right" VerticalAlign="Bottom" BorderColor="White" BorderSolid" BorderWidth="1px"/> <ItemStyle HorizontalAlign="Right" /> </asp:BoundField> <asp:BoundField datafield="LYTurnoverAmt" DataFormatString="{0:F0}" HeaderText="Last Year" ReadOnly="True" SortExpression="LYTurnoverAmt"> <HeaderStyle HorizontalAlign="Right" VerticalAlign="Bottom" BorderColor="White" BorderSolid" BorderWidth="1px"/> <ItemStyle HorizontalAlign="Right" /> </asp:BoundField> <asp:TemplateField HeaderText="%"> <ItemTemplate> <asp:Label ID="Label55" runat="server" Text="Label"></asp:Label> </ItemTemplate> <HeaderStyle VerticalAlign="Bottom" HorizontalAlign="Right" BorderColor="White" BorderSolid" BorderWidth="1px"/> <ItemStyle HorizontalAlign="Right" /> </asp:TemplateField> <asp:BoundField datafield="TYClients" HeaderText="This Year" ReadOnly="True" SortExpression="TYClients" > <HeaderStyle HorizontalAlign="Right" VerticalAlign="Bottom" BorderColor="White" BorderSolid" BorderWidth="1px"/> <ItemStyle HorizontalAlign="Right" /> </asp:BoundField> <asp:BoundField datafield="LYClients" HeaderText="Last Year" ReadOnly="True" SortExpression="LYClients" > <HeaderStyle HorizontalAlign="Right" VerticalAlign="Bottom" BorderColor="White" BorderSolid" BorderWidth="1px"/> <ItemStyle HorizontalAlign="Right" /> </asp:BoundField> <asp:TemplateField> <ItemTemplate> <asp:ImageButton ID="ImageButton5" runat="server" ImageUrl="~/Images/arrow.png" onclick="ImageButton5_Click" /> </ItemTemplate> </asp:TemplateField> </Columns> <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /> <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /> <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> <EditRowStyle BackColor="#999999" /> <AlternatingRowStyle BackColor="White" ForeColor="#284775" /> </asp:GridView> <br /> <asp:Chart ID="Chart2" runat="server" DataSourceID="sqlDataSourceDag" BackColor="#CFD1D2" > <Titles> <asp:Title Name="Title1" Text="Turnover"> </asp:Title> </Titles> <series> <asp:Series Name="ThisYear" XValueMember="Day" YValueMembers="TYTurnoverAmt" LegendText="Turnover this year"> </asp:Series> <asp:Series Name="LastYear" XValueMember="Day" YValueMembers="LYTurnoverAmt" LegendText="Turnover last year"> </asp:Series> </series> <chartareas> <asp:ChartArea Name="ChartArea1" Area3DStyle-Enable3D="true" Area3DStyle-IsClustered="true" BackColor="White" > <AxisY IntervalAutoMode="VariableCount" IntervalType="Number" IntervalOffsetType="Number"> </AxisY> <Area3DStyle Enable3D="True" IsClustered="True" /> </asp:ChartArea> </chartareas> <Legends> <asp:Legend Docking="Bottom" Name="Legend1" BackColor="#CFD1D2" > </asp:Legend> </Legends> </asp:Chart> <asp:Chart ID="Chart1" runat="server" DataSourceID="sqlDataSourceDag" BackColor="#CFD1D2"> <Titles> <asp:Title Name="Title1" Text="Clients"> </asp:Title> </Titles> <series> <asp:Series ChartType="Line" Legend="Legend1" Name="ClientTY" XValueMember="Day" YValueMembers="TYClients" BorderWidth="3" LegendText="Clients this year"> </asp:Series> <asp:Series ChartType="Line" Legend="Legend1" Name="ClientLY" XValueMember="Day" YValueMembers="LYClients" BorderWidth="3" LegendText="Clients last year"> </asp:Series> </series> <chartareas> <asp:ChartArea Name="ChartArea1" > <AxisY IntervalAutoMode="VariableCount" IntervalType="Number" IntervalOffsetType="Number"> </AxisY> <AxisX IsLabelAutoFit="False"> <LabelStyle Angle="-90" /> </AxisX> </asp:ChartArea> </chartareas> <Legends> <asp:Legend Docking="Bottom" Name="Legend1" BackColor="#CFD1D2"> </asp:Legend> </Legends> </asp:Chart> <br /> <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Back" Visible="False" /> <br /> <asp:sqlDataSource ID="sqlDataSourceDag" runat="server" ConnectionString="<%$ ConnectionStrings:OSCConnectionString %>" SelectCommand="WWWiPhoneAllStoresPerDay" SelectCommandType="StoredProcedure"> </asp:sqlDataSource> </asp:View> ....second view stripped </asp:MultiView> </ContentTemplate> </asp:UpdatePanel> </div> </form> </body> </html>

WP7不支持属性initial-scale,minimum-scale和maximum-scale。 目前,您只能使用高度,宽度和用户可扩展性。 我发现,马特链接博客文章有一些不正确的/误导性的信息。 有关更准确的信息,请参见以下内容: http : //msdn.microsoft.com/zh-cn/library/ff462082%28VS.92%29.aspx

此外,从我所看到的,WP7需要属性间的分隔符是逗号,而不是分号。

不能看到你要显示页面,这很难说,但听起来你可能在网页上有其他东西影响网格的显示

作为参考,视口选项记录在http://blogs.msdn.com/b/iemobile/archive/2010/11/22/the-ie-mobile-viewport-on-windows-phone-7.aspx

我发现移动Windows 7最适合的视口是:

<Meta id="viewport" name="viewport" content="width=${wurfl.getProperty('max_image_width')}; initial-scale=1.0; maximum-scale=1.0"/>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐