小编Mar*_*ský的帖子

Command(ICommand)和Click事件之间的区别

我什么时候应该使用Command和何时使用该Click活动?

如果Button我的UWP应用程序中有我应该使用的是什么?

c# xaml win-universal-app uwp windows-10-universal

10
推荐指数
1
解决办法
2498
查看次数

使用PowerShell或MSBuild获取UWP Store关联

我正在使用AppVeyor CI构建我的UWP应用程序,并希望在每次构建期间创建一个APPX包.但是我.gitignore是忽略了Package.StoreAssociation.xmlMyAppName_StoreKey.pfx我想在APPX包中包括他们正在确定在Windows商店我的应用程序.

有没有办法使用PowerShell或MSBuild或类似的东西获取这些文件?换句话说,是否有任何命令行等同于Project > Store > Associate App with the Store...向导?

我知道我可以将这些文件作为安全文件上传到repo,但我更喜欢从开发中心获取每个版本的最新文件.

msbuild powershell win-universal-app uwp

10
推荐指数
1
解决办法
334
查看次数

Windows.Foundation.UniversalApiContract 在哪里?

我正在调用:FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();在我的 uwp 应用程序中启动 win32 应用程序。然后我尝试打开 uwp 和 win32 应用程序之间的连接,并将消息从 uwp 发送到 win32。我创建一个ValueSet valueSet = new ValueSet();

但在编译时,它会抱怨:

Error CS0433 The type 'ValueSet' exists in both
'Windows.Foundation.FoundationContract, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=null, ContentType=WindowsRuntime' and 'Windows,
Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'  
Run Code Online (Sandbox Code Playgroud)

我确实手动添加了引用以便C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Windows.winmd能够调用 FullTrustProcessLauncher,并且我相信我想使用ValueSetthis 内部的内容Windows.winmd

我很困惑它在哪里Windows.Foundation.FoundationContract,它在我的项目中怎么样?我怎样才能删除它?

谢谢!

c# reference uwp

4
推荐指数
2
解决办法
2万
查看次数

UWP 阻止 MessageDialog 关闭父 ContentDialog

我的应用程序使用 ContentDialog 作为数据插入的方式。换句话说; 数据形式是一个ContentDialog。在验证用户输入期间,应用程序应使用 MessageDialog 向用户提示任何错误。但是,关闭 MessageDialog 也会关闭 ContentDialog。

这是显示警报时的代码块:

private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
    //save item
    ValidateForm();
}

private void ContentDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
}

private async void ValidateForm()
{
    //Ensure all fields are filled
    String barcode = BarcodeText.Text.Trim();
    String desc = DescText.Text.Trim();
    String cost = CostText.Text.Trim();
    String price = PriceText.Text.Trim();
    String stock = StockText.Text.Trim();

    if(barcode.Equals(String.Empty) || desc.Equals(String.Empty) ||
            desc.Equals(String.Empty) || cost.Equals(String.Empty) || 
            price.Equals(String.Empty) || stock.Equals(String.Empty))
    {
        var dialog = new MessageDialog("Please fill in all fields"); …
Run Code Online (Sandbox Code Playgroud)

c# uwp

1
推荐指数
1
解决办法
1301
查看次数

XAML布局问题

我是UWP的新手,并且在一天中的大部分时间都在努力应该是一些简单的XAML,但我无法按照我想要的方式进行布局.我想要实现的目标如下所示.

在第1列中水平和垂直居中的单个文本.在第2列中左对齐的2个文本.在第3列中水平和垂直居中的单个文本.

这是我到目前为止的XAML.我知道我需要使用列,但即使在尝试这样做时,我根本无法获得正确的布局.

<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:TramTimes"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Class="TramTimes.ServicesPage"
mc:Ignorable="d">

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <ListView x:Name="list" IsItemClickEnabled="False" SelectionMode="None">
        <ListView.ItemTemplate>
            <DataTemplate>
                <Grid>
                    <StackPanel>
                        <TextBlock Text="{Binding Destination}"/>
                        <TextBlock Text="{Binding Company}"/>
                    </StackPanel>
                </Grid>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>
</Grid>
</Page>
Run Code Online (Sandbox Code Playgroud)

感谢任何帮助,使列表看起来像我需要的方式.

编辑

这是我现在使用的代码和我得到的结果 - 任何人都可以帮助我让网格填满整个列表的宽度?

<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:TramTimes"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Maps="using:Windows.UI.Xaml.Controls.Maps"
x:Class="TramTimes.ServicesPage"
mc:Ignorable="d">

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <Maps:MapControl x:Name="map" Height="300" VerticalAlignment="Top"/>
    <ListView x:Name="list" IsItemClickEnabled="False"  Margin="0,300,0,0" SelectionMode="None">
        <ListView.ItemTemplate>
            <DataTemplate>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="1*"/>
                        <ColumnDefinition Width="3.5*"/>
                        <ColumnDefinition Width="1*"/>
                    </Grid.ColumnDefinitions>

                    <TextBlock Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding Scheduled}"/>

                    <StackPanel Grid.Column="2"> …
Run Code Online (Sandbox Code Playgroud)

c# xaml uwp

1
推荐指数
1
解决办法
128
查看次数