windows - 无法获得适用于 Windows Phone 7 的初始比例

标签 windows windows-phone-7 meta-tags

我的 winphone 7 应用程序中有一个网络浏览器,用于显示一些网页,其中包含左右 2 个按钮,中间有一个标题,下面是一个 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" /--> 

如果我使用 device-width,我的 gridview 中的最后几列不在屏幕上,尝试使用 initial-scale 正确缩放它没有任何作用。 如果我使用设置的宽度,例如 320 或 640,gridview 会变小(小于屏幕的宽度),并且 initial-scale 再次不执行任何操作。

有什么想法吗?

添加了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" BorderStyle="Solid" 
                        BorderWidth="1px"/>
                    </asp:BoundField>
                    <asp:BoundField DataField="LYBusinessDate" DataFormatString="{0:dd/MM}" 
                        HeaderText="Last Year" ReadOnly="True" 
                        SortExpression="LYBusinessDate">
                    <HeaderStyle VerticalAlign="Bottom" BorderColor="White" BorderStyle="Solid" 
                        BorderWidth="1px"/>
                    </asp:BoundField>
                    <asp:BoundField DataField="Day" HeaderText="Day" ReadOnly="True" 
                        SortExpression="Day">
                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Bottom" BorderColor="White" BorderStyle="Solid" 
                        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" BorderStyle="Solid" 
                        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" BorderStyle="Solid" 
                        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" BorderStyle="Solid" 
                        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" BorderStyle="Solid" 
                        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" BorderStyle="Solid" 
                        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。目前,您只能使用高度、宽度和用户可缩放。我发现 Matt 链接到的博客文章有一些不正确/误导性的信息。有关更准确的信息,请参阅以下内容:http://msdn.microsoft.com/en-us/library/ff462082%28VS.92%29.aspx

此外,据我所知,WP7 需要属性之间的分隔符为逗号,而不是分号。

关于windows - 无法获得适用于 Windows Phone 7 的初始比例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4585648/

相关文章:

Windows关闭时的Java关闭 Hook 调用

.net - 如何在 Visual Studio 2010 Express for Windows Phone 上安装可移植库工具

ios - 在WP7中解析iOS .plist文件

windows-phone-7 - WP7中ListBox可以有列吗?

php - 使用 PHP 从 URL 中获取 "property og"元标记

asp.net - 如何将元标记添加到 ASP.Net 内容页面

C++在程序文件中创建文件的过程

c++ - 特定资源语言的 LoadAccelerators

windows - Sbt 检索所需库时出错

header - X-Robots-Tag header 与机器人元标记的优先级