嘿伙计们,每当将一个新项目添加到itemssource时,我想将列表框滚动条移动到底部,但是如果我将它传递给新添加的项目或索引,则ScrollIntoView()似乎没有做任何事情.它的.有没有人得到这个工作,或者有任何其他建议,如何我可以将列表框滚动到底部?
一些代码:
void Actions_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
//if a new item was added, set it to the selected item
if (e.NewItems != null)
{
MainListBox.SelectedIndex = e.NewStartingIndex;
//MainListBox.ScrollIntoView(MainListBox.Items.Last()); //todo: this doesnt seem to work
}
}
Run Code Online (Sandbox Code Playgroud) 我一直在研究Windows Phone 7应用程序,经过一些谷歌搜索后,似乎我已经添加到Visual Studio项目的图像,我需要将构建操作设置为"内容",以便能够参考我的应用程序中的图像.
但是,Windows Phone列表应用程序项目模板包含一个映像(ArrowImg.png),其构建操作设置为"资源",并且仍可从应用程序引用.
我想知道是否有人可以确认我们肯定应该使用内容构建操作,或者是否有某种方法来访问使用资源构建操作添加到项目中的图像,如项目示例中所示,我们应该使用它?
我为我的MVC WebAPI项目设置了常规的OWIN OAuth设置 - 来自前端开发人员的一个请求是能够确定令牌是否因为过期而被拒绝,或者它只是一个无效的令牌.
据我所知,默认情况下,OAuthAuthorizationServerProvider位于中间,并且神奇地拦截查看承载令牌的Authorization标头的请求,并确定是否已对此请求授权或发送401/Authorization.
是否可以自定义此行为/是否有任何其他方法来确定授权被拒绝的原因?
我可以看到存在以下方法:
public virtual Task ValidateAuthorizeRequest(OAuthValidateAuthorizeRequestContext context);
Run Code Online (Sandbox Code Playgroud)
但是我不确定默认的实现是什么,看起来是什么,或者这是否是我应该去定制提供程序以实现我所追求的目标.
我在Startup.cs中的OAuthOptions:
OAuthOptions = new OAuthAuthorizationServerOptions
{
TokenEndpointPath = new PathString("/Token"),
Provider = new ApplicationOAuthProvider(PublicClientId, UserManagerFactory),
AuthorizeEndpointPath = new PathString("/api/Account/ExternalLogin"),
AccessTokenExpireTimeSpan = TimeSpan.FromMinutes(60),
AllowInsecureHttp = true
};
Run Code Online (Sandbox Code Playgroud) 我有一个问题,我可以启用UI的功能,一切都按预期通过网站设置工作,但如果我尝试通过Sharepoint powershell启用该功能(我们正在做脚本部署的一部分),我得到下列:
Enable-SPFeature:无法从程序集"xxxxx,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = 967e6960f5af91e6",类"xxxxx.EventReceiver"创建接收器对象,用于功能"xxxxx.Public.Search"(ID:026d7c45-a359) -4550-822d-1a6c35e58e0 d):System.ArgumentNullException:Value不能为null.参数名称:类型
有谁知道为什么会这样,或者我应该检查一些事情?功能定义肯定是正确的(因为通过UI部署它按预期工作,我还仔细检查了PublicKeyToken是否正确等等),并重新启动服务和iisreset也不能使我使用Enable-SPFeature.
我创建了几个Windows手机应用程序,我想链接到我的发布者页面,以显示我发布的所有应用程序.请注意,我正在使用C#和XAML 开发适用于Windows Phone 7.x的应用程序.
选项1)直接链接到我的发布者页面的URL(使用WebBrowserTask)
问题)商店的所有链接似乎都需要在URL中嵌入en-US语言.我担心其他国家/地区的用户会发生什么.
示例:http:/www.windowsphone.com/ zh-CN/store/publishers?publisherId = Microsoft%2BCorporation
是否有与语言无关的方式链接到商店中的发布者?
选项2)使用MarketplaceDetailTask链接到发布者
问题)从我所看到的,这只能用于链接到应用程序.我尝试使用我的发布者GUID并得到:市场错误 - 很抱歉,我们现在无法完成您的请求.
MarketplaceDetailTask marketplaceDetailTask = new MarketplaceDetailTask();
marketplaceDetailTask.ContentType = MarketplaceContentType.Applications;
marketplaceDetailTask.ContentIdentifier = <My Publisher GUID>;
marketplaceDetailTask.Show();
Run Code Online (Sandbox Code Playgroud)
选项3)使用MarketplaceSearchTask链接到发布者
问题)这允许用任何字符串搜索商店.问题是,当我将我的出版商名称放在搜索字符串中时,除了我的以外还会显示其他应用程序.我的发布商名称包含一个常用字词,任何显示该字词的应用都会显示.
MarketplaceSearchTask searchTask = new MarketplaceSearchTask();
searchTask.ContentType = MarketplaceContentType.Applications;
searchTask.SearchTerms = "<My Publisher Name>";
searchTask.Show();
Run Code Online (Sandbox Code Playgroud)
任何想法或建议将不胜感激!谢谢.
有谁知道如何向WebView控件提供凭据(甚至更好-在特定域用户的上下文中运行Windows 8 Metro风格的应用程序/ WinRT应用程序?)我尝试按照此处列出的HttpClient + WebView方法进行操作( http://social.msdn.microsoft.com/Forums/zh-CN/winappswithcsharp/thread/05e46a0a-e913-469d-a4a5-4a805dcf158a),但它仍提示用户输入凭据,因为在返回的内容中有指向安全物品。
我有一个NetworkCredential对象,我非常想将其应用于所进行的每个HTTP调用。
当然一定有人做过吗?:)
impersonation networkcredentials windows-8 dotnet-httpclient winrt-xaml
我需要一个webpart,它有一个标题的纯文本字段,一个缩略图的图像和一个HTML内容可编辑的块,所以我认为最好的方法是尝试扩展现有的内容编辑器Web部件.不幸的是,CEWP标记为密封,因此我不能将其子类化.我已经反思并尝试在我自己的自定义webpart中重新创建功能(请参阅代码的问题末尾),但我的自定义CEWP版本的内容不会保留.
有谁知道我怎么做:
提前致谢!
代码如下所示(停止编译的东西已被注释掉/更改/删除)
using System;
using System.ComponentModel;
using System.Security.Permissions;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml;
using System.Xml.Serialization;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Security;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;
namespace Public.Webparts
{
[ToolboxItemAttribute(false)]
[XmlRoot(Namespace="Webparts/ProductItem")]
public class ProductItemWebPart :System.Web.UI.WebControls.WebParts.WebPart
{
// Fields
private string _content;
private bool _contentHasToken;
private string _contentLink;
private string _partContent;
private string _partStorage;
private HtmlGenericControl editableRegion = new HtmlGenericControl();
private HtmlGenericControl emptyPanel = new HtmlGenericControl();
private const string EmptyPanelHtmlV4 …
Run Code Online (Sandbox Code Playgroud) 我目前正在开发一个将数据写入IsolatedStorageStore的应用程序.作为应用程序的一部分,我想实现一个"清除所有数据/重置"按钮,但枚举存在的所有文件和所有存在的文件夹花费了相当多的时间.是否有一种神奇的"重置"方法或我可以使用的东西,或者我应该专注于优化手动删除过程?
或者我可以逃脱不提供此类功能,并让用户卸载/重新安装应用程序以进行重置?
我可怕的delete-all-files方法如下:
/// <summary>
/// deletes all files in specified folder
/// </summary>
/// <param name="sPath"></param>
public static void ClearFolder(String sPath, IsolatedStorageFile appStorage)
{
//delete all files
string[] filenames = GetFilenames(sPath);
if (filenames != null)
{
foreach (string sFile in filenames)
{
DeleteFile(System.IO.Path.Combine(sPath, sFile));
}
}
//delete all subfolders if directory still exists
try
{
foreach (string sDirectory in appStorage.GetDirectoryNames(sPath))
{
ClearFolder(System.IO.Path.Combine(sPath, sDirectory) + @"\", appStorage);
}
}
catch (DirectoryNotFoundException ex)
{
//current clearing folder was deleted / no …
Run Code Online (Sandbox Code Playgroud) 我希望通过EntityFramework与Azure工作者角色中的SQL Server数据库进行通信来使用DbGeography.据我了解,DbGeography在后台使用Microsoft.SqlServer.Types/SqlServerSpatial110.dll,所以为了让它在Azure中工作,我遵循:
http://blogs.msdn.com/b/adonet/archive/2013/12/09/microsoft-sqlserver-types-nuget-package-spatial-on-azure.aspx并安装了nuget包,然后我指定了在WorkerRole.cs中的OnStart方法中加载SQL Server类型:
public override bool OnStart()
{
// Load SQL Server Types
SqlServerTypes.Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);
Run Code Online (Sandbox Code Playgroud)
然后我也按照这篇博文https://alastaira.wordpress.com/2011/08/19/spatial-applications-in-windows-azure-redux-including-denali/,在那里我明确地将SqlServerSpatial110.dll添加到项目中并设置它始终复制.
所以真正的问题是 - 在部署之后,一切都按预期工作.但是,如果我单独离开Azure Worker角色(约30分钟)并且它没有收到任何请求,则我的代码的DbGeography部分不再起作用.
此刻,我对承诺有点头脑风暴。
鉴于以下代码:
$scope.getData = function(user) {
return $http.post('/endpoint', "some post data", { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } })
.success(function (response) {
var myThing = { stuff: response.infoData };
localStorageService.set('myData', { stuff: response.infoData });
return myThing;
});
};
Run Code Online (Sandbox Code Playgroud)
是从成功回调返回的myThing对象:
据我了解:
这样对吗?是否有我遗漏的东西,在成功方法中返回对象有什么好处,还是返回是多余的?(我很清楚这是可以改进的代码,但我试图具体找出为什么有人会写这个,或者这完全是一个错误)
在我有三个组(今天,明天和更晚)的应用程序中有一个语义缩放控件,但这些组不一定总是至少有一个项目.当所有三个组都是非空的时,语义缩放控制工作完美,但是当任何项都为空时,语义缩放控制不起作用.我已经尝试清除我的DataTemplate以确保它与绑定无关,我找不到要挂钩的事件,以便我可以逐步完成触发缩小事件时发生的事情.
有没有人有这个工作,或有任何想法/建议/提示/解决方法?
一些代码:
XAML - collectionviewsource:
<!-- Collection of grouped items displayed by this page -->
<CollectionViewSource
x:Name="groupedItemsViewSource"
Source="{Binding Groups}"
IsSourceGrouped="True"
ItemsPath="Items"
d:Source="{Binding ItemGroups, Source={d:DesignInstance Type=data:AuctionDataSource, IsDesignTimeCreatable=True}}"/>
Run Code Online (Sandbox Code Playgroud)
XAML - 语义缩放控制:
<SemanticZoom Visibility="Collapsed" Grid.Row="1" Name="MainSemanticZoom">
<SemanticZoom.ZoomedInView>
<GridView
x:Name="itemGridView"
AutomationProperties.AutomationId="ItemGridView"
AutomationProperties.Name="Grouped Items"
Margin="116,0,40,46"
ItemsSource="{Binding Source={StaticResource groupedItemsViewSource}}"
SelectionMode="Multiple"
SelectionChanged="itemGridView_SelectionChanged_1">
<GridView.ItemTemplate>
<DataTemplate>
<Grid HorizontalAlignment="Left" Width="250" Height="200" RightTapped="Grid_RightTapped_1" Tag="{Binding}">
<Border Background="{StaticResource ListViewItemPlaceholderRectBrush}">
<Image Source="{Binding Image}" Stretch="UniformToFill"/>
</Border>
<StackPanel Grid.Column="1" VerticalAlignment="Bottom" Background="{StaticResource ListViewItemOverlayBackgroundBrush}">
<!--bindings: Title , CurrentBid, CloseDate -->
<TextBlock Text="{Binding Title}" Foreground="{StaticResource ListViewItemOverlayTextBrush}" Height="20" Style="{StaticResource …
Run Code Online (Sandbox Code Playgroud) c# ×4
silverlight ×2
windows-8 ×2
angularjs ×1
asp.net-mvc ×1
asynchronous ×1
azure ×1
javascript ×1
marketplace ×1
oauth ×1
optimization ×1
owin ×1
powershell ×1
promise ×1
publisher ×1
sql-server ×1
web-parts ×1
winrt-xaml ×1
wpf ×1