AdaptiveTrigger是否可以在DataTemplate中工作?
这是我用来自定义我的ShellNavigation的代码,除了视觉状态之外它工作得很好.它们不会触发任何东西.
<shell:ShellHeadView x:Key="ShellHeadView_01">
<shell:ShellHeadView.ContentTemplate>
<DataTemplate>
<Grid Margin="20,0">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState x:Name="GreenBackgroundVisualState">
<VisualState.Setters>
<Setter Target="headViewLeft.Background" Value="Green" />
</VisualState.Setters>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="1000"/>
</VisualState.StateTriggers>
</VisualState>
<VisualState x:Name="OrangeBackgroundVisualState">
<VisualState.Setters>
<Setter Target="headViewLeft.Background" Value="Orange" />
</VisualState.Setters>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="2000"/>
</VisualState.StateTriggers>
</VisualState>
<VisualState x:Name="RedBackgroundVisualState">
<VisualState.Setters>
<Setter Target="headViewLeft.Background" Value="Red" />
</VisualState.Setters>
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="3000"/>
</VisualState.StateTriggers>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" x:Name="headViewLeft" Width="100" Height="90">
</Grid>
Run Code Online (Sandbox Code Playgroud) 这是我的旧实现,用于获取Windows Universal 8.1的唯一DeviceID,但类型HardwareIdentification不再存在.
private static string GetId()
{
var token = HardwareIdentification.GetPackageSpecificToken(null);
var hardwareId = token.Id;
var dataReader = Windows.Storage.Streams.DataReader.FromBuffer(hardwareId);
byte[] bytes = new byte[hardwareId.Length];
dataReader.ReadBytes(bytes);
return BitConverter.ToString(bytes).Replace("-", "");
}
Run Code Online (Sandbox Code Playgroud) 有什么功能类似于BIT_COUNTMSSQL中的MYSQL 功能吗?我想在MSSQL中创建一个非常简单的汉明距离函数,我可以在我的选择中使用它.
这是我对MYSQL的看法:
CREATE FUNCTION `HAMMINGDISTANCE`(`hasha` BIGINT, `hashb` BIGINT)
RETURNS int(11)
DETERMINISTIC
RETURN
BIT_COUNT(hasha^hashb)
Run Code Online (Sandbox Code Playgroud) 我知道可以使用:
System.Diagnostics.StackTrace t = new System.Diagnostics.StackTrace();
Run Code Online (Sandbox Code Playgroud)
但这似乎不再起作用,因为它需要一个Exception-Object.
我有一个函数,可以向SQL Server数据库发送两个请求。但是,在第二个请求上,我得到一个SqlException并且参数@mpe丢失。如果我尝试0在的构造函数中设置常量值SqlParameter。
protected static string GetX(int mpe, string xsection, string xkey)
{
var xSetup = App.Current.Db.GetType<Data.CachedTypes.XSetup>(
"where mpehotel=@mpe and xsection=@xsection and xkey=@xkey",
new System.Data.SqlClient.SqlParameter("@mpe", mpe),
new System.Data.SqlClient.SqlParameter("@xsection", xsection),
new System.Data.SqlClient.SqlParameter("@xkey", xkey));
if (mpe > 0 && xSetup == null)
{
// Fallback mechanism. Always tries to get the default for all MPEs.
xSetup = App.Current.Db.GetType<Data.CachedTypes.XSetup>(
"where mpehotel=@mpe and xsection=@xsection and xkey=@xkey",
new System.Data.SqlClient.SqlParameter("@mpe", 0), <-- THIS FAILES!!
new System.Data.SqlClient.SqlParameter("@xsection", xsection),
new System.Data.SqlClient.SqlParameter("@xkey", …Run Code Online (Sandbox Code Playgroud) 是否可以标记的结果async Task<T>可以为null?使用属性[CanBeNull]不起作用,因为异步Task的返回值永远不会为null。
[CanBeNull] // not working...
private async Task<T> doSomeFancyAsyncStuff([NotNull] object icantbenull) { ...
Run Code Online (Sandbox Code Playgroud) c# ×5
windows-10 ×3
sql-server ×2
uwp ×2
.net ×1
annotations ×1
async-await ×1
mysql ×1
resharper ×1
sql ×1
sqlparameter ×1