我目前正在使用XAML设计一个Windows 8商店应用程序,但我有一个小的尺寸问题.我有一个带有DataTemple的ListView.
我的ListView和DataTemplate的代码如下:
<ListView x:Name="listPageItems"
Grid.Row="1"
SelectionMode="Extended"
IsSwipeEnabled="False"
ItemsSource="{Binding Mode=OneWay, Source={StaticResource items}}"
ItemTemplate="{StaticResource NavigationItemTemplate}"
ScrollViewer.VerticalScrollBarVisibility="Visible">
</ListView>
<DataTemplate x:Key="NavigationItemTemplate">
<Grid Height="75">
<Grid.RowDefinitions>
<RowDefinition Height="1.6*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Rectangle Fill="White" />
<Rectangle Fill="{StaticResource SSEGreenBrush}"
Grid.Row="1" />
<Border BorderThickness="2"
BorderBrush="{StaticResource SSEGreenBrush}"
Grid.RowSpan="2" />
<TextBlock x:Name="textTitle"
Text="{Binding ClientName}"
Style="{StaticResource TitleTextStyle}"
Foreground="{StaticResource SSEBlueBrush}"
Margin="10,5,5,5" />
<StackPanel Orientation="Horizontal"
Grid.Row="1"
HorizontalAlignment="Stretch">
<TextBlock Text="Last Edit :"
Style="{StaticResource SubtitleTextStyle}"
Foreground="{StaticResource SSEBlueBrush}"
Margin="3,0,0,3"
VerticalAlignment="Center" />
<TextBlock Text="SurveyDate"
Style="{StaticResource SubtitleTextStyle}"
Foreground="{StaticResource SSEBlueBrush}"
Margin="3,0,0,3"
VerticalAlignment="Center" />
</StackPanel>
</Grid>
</DataTemplate>
Run Code Online (Sandbox Code Playgroud)
列表视图位于网格列中,其固定宽度为240. …
是否可以在运行时按名称显示/隐藏GridView列?
我可以通过索引来完成,如下所示:
gridReviews.Columns[4].Visible = false;
Run Code Online (Sandbox Code Playgroud)
但是我想做以下事情:
gridReviews.Columns["Name"].Visible = false;
Run Code Online (Sandbox Code Playgroud)
最好的方法是什么?
我有一个带有角材料的角反应形式
对于我的所有控件,我添加了所需的验证器。
我不确定如何使用反应形式正确设置芯片控制。
您在哪里设置 formControlName 以便触发所需的验证器?目前我在输入字段上设置了它,我猜这是错误的。
我只希望 courseIds 是带有课程 ID 的逗号分隔字符串。
TS:
form: FormGroup;
ngOnInit() {
this.form = new FormGroup({
name: new FormControl("", [Validators.required]),
courseIds: new FormControl("", Validators.required)
});
}
Run Code Online (Sandbox Code Playgroud)
HTML:
<form [formGroup]="form" (ngSubmit)="submit()">
<mat-form-field>
<input matInput type="text" formControlName="name" placeholder="Name">
</mat-form-field>
<mat-form-field>
<mat-chip-list #chipList>
<mat-chip *ngFor="let cid of courseIds" (removed) = "...">
{{cid}}
</mat-chip>
<input matInput formControlName="courseIds"
[matChipInputFor]="chipList"
placeholder="Ids"
(matChipInputTokenEnd)="add($event)">
</mat-chip-list>
</mat-form-field>
....
<button type="submit">OK</button>
</form>
Run Code Online (Sandbox Code Playgroud) 我正在为Windows 8平板电脑编写WPF应用程序.它是完整的Windows 8而不是ARM/RT.
当用户输入文本框时,我使用以下代码显示屏幕键盘:
System.Diagnostics.Process.Start(@"C:\Program Files\Common Files\Microsoft Shared\ink\TabTip.exe");
Run Code Online (Sandbox Code Playgroud)
这工作正常,但我不知道如何再次隐藏键盘?
有人知道怎么做吗?
此外,有什么方法可以调整我的应用程序大小,以便在键盘出现时向上移动聚焦控制?有点像它对Windows RT应用程序.
非常感谢
我正在使用WPF编写一个Windows 8平板电脑应用程序,并在屏幕上有一个ListView控件.
列表视图包含多个覆盖1页以上的行,因此启用了垂直滚动.
当我触摸屏幕时,当我向上和向下滚动时,会出现淡蓝色选择器并停留在屏幕中间(但是以深蓝色突出显示的所选项目不会改变).我猜它是鼠标效果,因为当我使用鼠标时会出现相同的效果.
我也使用DataTemplate作为items集合.
我怎样才能获得淡蓝色鼠标的效果?
这是我的ListView的XAML
<ListView Grid.Row="1"
Margin="10"
HorizontalContentAlignment="Stretch"
ItemsSource="{Binding Source={StaticResource MyData}}"
ItemTemplate="{StaticResource MyItemTemplate}"
ScrollViewer.CanContentScroll="False"
ScrollViewer.PanningMode="VerticalOnly"
ScrollViewer.PanningRatio="0.5">
</ListView>
Run Code Online (Sandbox Code Playgroud)
这是我的项目模板:
<DataTemplate x:Key="MyItemTemplate">
<Grid Margin="10,5">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Border BorderBrush="Gray"
BorderThickness="1"
Grid.RowSpan="2"
CornerRadius="5" />
<TextBlock Text="{Binding Name}"
FontSize="20"
VerticalAlignment="Center"
Grid.Row="0"
Margin="10" />
<Border Background="#FFB9B9B9"
Grid.Row="1"
CornerRadius="5"
Margin="10,0,10,4">
<StackPanel HorizontalAlignment="Stretch"
Orientation="Horizontal"
Grid.Row="1">
<TextBlock VerticalAlignment="Center"
Text="Status: "
Margin="5,5,0,5" />
<TextBlock VerticalAlignment="Center"
Text="{Binding CompletionStatus}" />
<TextBlock VerticalAlignment="Center"
Text="% complete, " />
<TextBlock VerticalAlignment="Center"
Text="Upload status: " />
<TextBlock VerticalAlignment="Center"
Text="{Binding …Run Code Online (Sandbox Code Playgroud) 我试图将存储过程的结果放入游标中以在当前过程中使用.我在下面添加了我的代码,但我不确定这是否可行或我的语法是否正确?
DECLARE cursorIDList CURSOR FOR
EXEC spGetUserIDs
OPEN cursorIDList
FETCH NEXT FROM cursorIDList INTO @ID
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:'EXEC'附近的语法不正确.期待SELECT,'('或WITH.
提前致谢.
如何在SQL Server中LIKE的DateTime数据类型列上执行语句?
如果我运行以下SQL,它将返回2009年的所有日期.
SELECT * FROM MyTable where CheckDate LIKE '%2009%'
Run Code Online (Sandbox Code Playgroud)
但是,如果我想要10月,11月和12月的所有日期,我希望能够做到以下几点:
SELECT * FROM MyTable where CheckDate LIKE '%2009-1%'
Run Code Online (Sandbox Code Playgroud)
但这没有给我任何回报!
我给用户一个过滤选项,他们输入日期字符串,当他们输入我过滤数据.因此,如果他们键入'20',我想在日期内返回所有日期为'20'(所以这可能是所有2012日期或日期值,如06/20/1999)
有人可以帮忙吗?
我正在使用SQL Server 2008.
提前致谢.
我有一个TextBlock,其中包含一长串文本,我想要包装.我已经将TextBlock放在ViewBox中,期望文本大小在仍然换行时改变,但是这似乎不会发生.ViewBox只调整TextBox的大小,以便所有文本都适合一行,使文本非常小.
如何在仍使用TextWrapping的同时使用ViewBox调整文本大小.
这是我的代码:
<Viewbox>
<TextBlock Text="The Option text can also dynamically grow/shrink to fit more content. More text to go here....................." TextWrapping="Wrap"/>
</Viewbox>
Run Code Online (Sandbox Code Playgroud)
这是Windows 8商店应用程序的一部分,因此是WinRT Xaml.
如果我有一个 DbContext 如下(这是一个标准的数据库上下文):
public class MyContext : DbContext, IAudit
{
public MyContext(DbContextOptions options) : base(options) { }
public DbSet<Audit> Audit { get; set; }
}
public interface IAudit
{
DbSet<Audit> Audit { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我打开了可为空引用类型。
我收到关于构造函数的警告:
退出构造函数时,不可为空的属性“Audit”必须包含非空值。考虑将该属性声明为可为空。
我怎样才能让这个警告消失(并保留界面)?
我正在编写一个WPF应用程序,它将在完整的Windows 8触摸屏平板电脑(不是RT)上运行.
但是,触摸滚动似乎不起作用.所以我想知道这是我做错了什么,或者它是否可能?
所以,我有一个带滚动查看器的WPF窗口.在该滚动查看器中,我有一个StackPanel,其中包含大量文本块.见下文:
<ScrollViewer>
<StackPanel>
<TextBlock Text="Row 1" />
<TextBlock Text="Row 2" />
<TextBlock Text="Row 3" />
<TextBlock Text="Row 4" />
<TextBlock Text="Row 5" />
<TextBlock Text="Row 6" />
....
<TextBlock Text="Row 50" />
</StackPanel>
</ScrollViewer>
Run Code Online (Sandbox Code Playgroud)
现在使用触摸屏我尝试滚动内容但它不移动.我只能使用侧面scollbar滚动内容,这不是我想要的方式.是否可以使用WPF进行触摸滚动?我也想对网格做同样的事情.
提前致谢.
我正在使用Visual Studio/Blend 2012.
touchscreen ×3
windows-8 ×3
wpf ×3
c# ×2
sql ×2
winrt-xaml ×2
angular ×1
asp.net-4.0 ×1
c#-8.0 ×1
cursor ×1
datetime ×1
gridview ×1
hide ×1
listview ×1
listviewitem ×1
mouseover ×1
scrollviewer ×1
sql-server ×1
textblock ×1
viewbox ×1
word-wrap ×1
xaml ×1