我正在学习xamarin形式和mvvm模式.我想知道,是否有可能否定绑定bool值.我的意思是:
我有,让我们说使用isVisible Binding进入:
<Entry
x:Name="TextEntry"
IsVisible="{Binding IsVisibleEntry}"
/>
Run Code Online (Sandbox Code Playgroud)
并且Label我想隐藏时TextEntry可见.
<Label x:Name="MainLabel"
isVisible="!{Binding IsVisibleEntry}"/> //ofc it is not working
Run Code Online (Sandbox Code Playgroud)
是否可以不在ViewModel中为MainLabel创建新变量?
我想同时使用EF和MVVM,并试图看看它们是如何组合在一起的.我不能在例子的方式中找到很多,所以希望你们能回答几个问题.
假设我在名为Customer的数据库中有一个表.我运行EF设计器并获得数据模型.
下一步是运行一些linq以从数据模型中获取数据.让我们创建一个名为CustomerRepository的新类来执行此操作.
现在我猜模型会调用CustomerRepository.GetCustomers来获取客户列表.
这是我的问题 - CustomerModel有一个由EF在数据模型中定义的客户对象列表.如何向其添加验证属性或任何类型的验证?
EF和MVVM之间似乎有点脱节.我相信你们中的一些人之前已经打过这个 - 任何想法?有没有更好的方法来接近这个?
干杯
史蒂夫
我在IIS上运行.Net 4.0 WCF服务.我没有指定端口,所以假设它在端口80上运行.我需要在已经使用端口80的服务器上安装我的服务,并且网络人员要求我将服务更改为在端口443上运行.如何操作我这样做?我猜它可以在app.config中配置,但我找不到一篇文章告诉我如何.
这是我当前的app.config:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
Run Code Online (Sandbox Code Playgroud)
我想从枢轴控件创建一个向导控件.为此,我需要停止枢轴循环.我想阻止枢轴控制从最后一个项目向前移动到第一个项目,从第一个项目向后移动到最后一个项目.
我很确定我应该能够拦截操作,例如取消,如果我在最后一个枢轴项上检测到从右到左的操纵.我可以在ManipulationDelta中捕获它,但不知道如何取消操作.
我试过设置e.Handled = True但它没有用.
我试图将IsHitTestVisisble设置为false但这会杀死所有操作.我尝试在ManipulationCompleted中将其设置为true,但这允许所有操作.
有任何想法吗?
干杯
史蒂夫
我使用Delphi很多年了,虽然我现在已经转移到Visual Studio,但我仍然记得编号书签(CTRL+ K+ 1来设置书签1,CTRL+ Q+ 1来转到书签1).
是否有Visual Studio等价物?在Delphi之后,我发现VS中的蠢书是一件苦差事.我想书签然后返回到文件中的特定位置.
我有一个WP7应用程序,它有一个搜索页面.我更喜欢挂钩硬件搜索按钮而不必将搜索图标添加到菜单栏.
有没有人想出怎么做?
对不起,这是C#和VB.Net的混合体
我有一个带有2个代表的C#类:
public delegate string GetSettingDelegate(string key);
public event GetSettingDelegate GetSettingEvent;
public delegate void SetSettingDelegate(string key, string value);
public event SetSettingDelegate SetSettingEvent;
Run Code Online (Sandbox Code Playgroud)
在VB类中,我为事件添加了处理程序:
AddHandler _gisCtrl.SetSettingEvent, AddressOf SetSetting
AddHandler _gisCtrl.GetSettingEvent, AddressOf GetSetting
Run Code Online (Sandbox Code Playgroud)
当我尝试删除处理程序时:
RemoveHandler _gisCtrl.SetSettingEvent, AddressOf SetSetting
RemoveHandler _gisCtrl.GetSettingEvent, AddressOf GetSetting
Run Code Online (Sandbox Code Playgroud)
SetSetting没问题,但GetSetting会发出警告:
AddressOf表达式在此上下文中无效,因为AddressOf的方法参数需要与事件的delagate类型进行轻松的对话.
这是方法
Private Sub SetSetting(ByVal key As String, ByVal value As String)
KernMobileBusinessLayer.[Global].Settings.SetValue(key, value)
End Sub
Private Function GetSetting(ByVal key As String)
Return KernMobileBusinessLayer.[Global].Settings.GetString(key)
End Function
Run Code Online (Sandbox Code Playgroud)
任何想法如何解决这个问题以及为什么它首先被抛出?2个委托/事件/方法看起来很相似,我不知道为什么一个是好的,一个人发出警告.
是否可以使用Entity Framework将数据保存到Windows Phone 8上的隔离存储中的SQL CE数据库?
当我尝试使用NuGet添加对EF 5的引用时,我收到错误:
"无法添加对'System.Data.Entity'的引用.请确保它在全局程序集缓存中."
有任何想法吗?
我正在开发一个Xamarin.Android应用程序.每当我尝试下载JSON提要时,我都会收到错误"您的应用程序已进入中断状态,但没有代码显示,因为所有线程都在执行外部代码".
我的json feed下载代码
string url = "http://xamdev.epizy.com/getData1.php";
public async void downloadJsonFeedAsync(String url) {
var httpClient = new HttpClient();
Task<string> contentsTask = httpClient.GetStringAsync(url);
// await! control returns to the caller and the task continues to run on another thread
string content = await contentsTask;
Console.Out.WriteLine("Response Body: \r\n {0}", content);
//Convert string to JSON object
result = Newtonsoft.Json.JsonConvert.DeserializeObject<RootObject> (content);
//Update listview
RunOnUiThread (() => {
listView.Adapter = new CusotmListAdapter(this, result.posts);
progress.Visibility = ViewStates.Gone;
});
}
Run Code Online (Sandbox Code Playgroud)我在这条线上有错误
string content = …
我有WP7工具包,我正在使用切换开关.
此时它显示On或Off.
我知道你可以使用内容模板自定义它,并且随关于它提供的示例代码显示了这一点,但是我找不到一种方法来打开/关闭其他东西.
我想显示是和否.