尝试从MasterDetail菜单启动设置页面时出现错误var all_checked = new Array();
function add_checked(el) {
all_checked.push(el.id);
}
。从研究中我知道,这意味着无法实例化该页面。这是页面的<form action="/action_page.php">
<table id="t01" width="1200" height="10" border="3">
<tbody>
<tr><th>DETAILS</th>
<th>OK</th>
<th>FIXED</th>
<th>INCOMPLETE</th>
<th>N/A</th>
<th>NOTES</th>
</tr>
<tr>
<td><b>MOTOR & REDUCER-</b>Are correct and installed properly.</td>
<td><input name="INS1" id="CHK22" onclick="ckChange(this)" type="checkbox"><br></form></td>
<td><input name="INS1" id="CHK23" onclick="ckChange(this)" type="checkbox"><br></td>
<td><input name="INS1" id="CHK24" onclick="ckChange(this)" type="checkbox"><br></td>
<td><input name="INS1" id="CHK25" onclick="ckChange(this);add_checked(this)" type="checkbox"><br></td>
<td width="15%">
<textarea placeholder="Type notes and remarks." cols="55"></textarea>
</td>
</tr>
<tr>
<td><b>REDUCER LUBRICATION-</b>Reducer is filled with oil (Mobil SHC 634/ISO VG 460)(ISS 0.7).</td>
<td><input name="INS2" id="CHK26" onclick="ckChange(this)" type="checkbox"><br></form></td>
<td><input name="INS2" id="CHK27" onclick="ckChange(this)" type="checkbox"><br></td>
<td><input name="INS2" id="CHK28" onclick="ckChange(this)" type="checkbox"><br></td>
<td><input name="INS2" id="CHK29" onclick="ckChange(this);add_checked(this)" type="checkbox"><br></td>
<td>
<textarea placeholder="Type notes and remarks." cols="55"></textarea>
</td>
</tr>
</table>
</form>
。
我正在使用James Montenegro的System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation
存储设置。
xaml
这是背后的代码
xam.plugins.settings
和ViewModel
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="EIOBoardMobile.Views.SettingsPage"
Title="Settings">
<ContentPage.Content>
<StackLayout>
<Label Text="Connection Information" />
<StackLayout>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackLayout Orientation="Vertical" Grid.Row="0" Grid.Column="0" >
<StackLayout.GestureRecognizers>
<TapGestureRecognizer
Tapped="OnServerTapped"
NumberOfTapsRequired="1" />
</StackLayout.GestureRecognizers>
<Label Text="Server name" />
<Label x:Name="Server" Text="{Binding Connection}" />
</StackLayout>
<Label Text="{Binding UserName}" Grid.Row="1" Grid.Column="0"/>
<Label Text="{Binding Password}" Grid.Row="2" Grid.Column="0"/>
<StackLayout Orientation="Vertical" Grid.Row="3" Grid.Column="0" >
<Label Text="Test Connection" />
<Label Text="Click to test your connection settings" />
</StackLayout>
</Grid>
<Label Text="Location" />
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="***" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="Location Tracking" Grid.Row="0" Grid.Column="0" />
<Switch IsToggled="{Binding LocationTracking}" Grid.Row="0" Grid.Column="1" />
<StackLayout Orientation="Vertical" Grid.Row="1" Grid.Column="0">
<Label Text="Location Caching" />
<Label Text="WARNING! Experimental! Stores location data while offline." />
</StackLayout>
<Switch IsToggled="{Binding LocationCaching}" Grid.Row="1" Grid.Column="1" />
</Grid>
<Label Text="Logging Options" />
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="***" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackLayout Orientation="Vertical" Grid.Row="0" Grid.Column="0">
<Label Text="Allow Logging" />
<Label Text="Collecting crash data" />
</StackLayout>
<Switch IsToggled="{Binding AllowLogging}" Grid.Row="0" Grid.Column="1" />
<StackLayout Orientation="Vertical" Grid.Row="1" Grid.Column="0">
<Label Text="Crash log email" />
<Label Text="Provide us an email to contact you regarding crash logs" />
</StackLayout>
</Grid>
<Label Text="Caching Options" />
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="***" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackLayout Orientation="Vertical" Grid.Row="0" Grid.Column="0">
<Label Text="Caching" />
<Label Text="CacheSize:" />
</StackLayout>
<Switch IsToggled="{Binding Caching}" Grid.Row="0" Grid.Column="1" />
<StackLayout Orientation="Vertical" Grid.Row="1" Grid.Column="0">
<Label Text="Delete Cache" />
<Label Text="Click to delete the application cache" />
</StackLayout>
</Grid>
<Label Text="Updates" />
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="***" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Text="Notify me of new updates" Grid.Row="0" Grid.Column="0" />
<Switch IsToggled="{Binding UpdateNotify}" Grid.Row="0" Grid.Column="1" />
<Label Text="Check for updates" Grid.Row="1" Grid.Column="0" />
</Grid>
</StackLayout>
</StackLayout>
</ContentPage.Content>
</ContentPage>
知道我在做什么错吗? IDE未显示任何错误。我尝试以2种或3种不同方式设置using EIOBoardMobile.ViewModel;
using EIOBoardMobile.Views.popups;
using Rg.Plugins.Popup.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace EIOBoardMobile.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class SettingsPage : ContentPage
{
public SettingsPage ()
{
InitializeComponent ();
BindingContext = new SettingsPageViewModel();
}
public async void OnServerTapped(object sender, EventArgs e)
{
await Navigation.PushPopupAsync(new ConnectionPopupPage());
}
}
}
操作。我是否不能将using EIOBoardMobile.Helpers;
using EIOBoardMobile.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Text;
using System.Windows.Input;
namespace EIOBoardMobile.ViewModel
{
public class SettingsPageViewModel : INotifyPropertyChanged
{
public ICommand ItemSelectedCommand { get; private set; }
public SettingsPageViewModel()
{
}
public void OnCreate()
{
}
public string Connection
{
get { return Settings.ConnectionAddress; }
set { Settings.ConnectionAddress = value; }
}
public string UserName
{
get { return Settings.UserName; }
set { Settings.UserName = value; }
}
public string Password
{
get { return Settings.Password; }
set { Settings.Password = value; }
}
public bool LocationTracking
{
get { return Settings.LocationTracking; }
set { Settings.LocationTracking = value; }
}
public bool LocationCaching
{
get { return Settings.LocationCaching; }
set { Settings.LocationCaching = value; }
}
public bool AllowLogging
{
get { return Settings.AllowLogging; }
set { Settings.AllowLogging = value; }
}
public string CrashLogEmail
{
get { return Settings.CrashLogEmail; }
set { Settings.CrashLogEmail = value; }
}
public bool Caching
{
get { return Settings.Caching; }
set { Settings.Caching = value; }
}
public bool UpdateNotify
{
get { return Settings.UpdateNotify; }
set { Settings.UpdateNotify = value; }
}
public event PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(
[CallerMemberName] string caller = "")
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(caller));
}
}
}
}
放在OnTapped
内?任何帮助将不胜感激。
答案 0 :(得分:1)
closest(4, 5) -- prints 5
closest(5.85, 5) -- prints 5
closest(52.4, 5) -- prints 50
closest(93.594664, 9) -- prints 90
是GridUnitType
:
因此,根据Xamarin的XAML规则,这将无效:
Enum
这些是有效的:
<ColumnDefinition Width="***" />
您的XAML应该类似于:
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="100" />