0

我的问题是我的 Visual Studio(Visual Studio Community 2017,UWP C# 项目)不想在设计器中显示我的 AppBar 或 ListView 模板元素。当我运行应用程序(Windows 10)时,两者都存在,但必须有一种方法可以在设计器中显示内置于 ListView 模板中的元素,或者至少应该显示我的 AppBar,对吧?

示例代码:

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

    <Page.BottomAppBar>
        <CommandBar>
            <AppBarButton Icon="Add" Label="Increment" ToolTipService.ToolTip="Increment"/>
            <AppBarButton Icon="Remove" Label="Decrement" ToolTipService.ToolTip="Decrement"/>
        </CommandBar>
    </Page.BottomAppBar>

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <ListView Grid.Row="1" BorderBrush="Silver" BorderThickness="0 0 1 2" SelectionMode="None" Padding="0 10" ItemsSource="{x:Bind balanceAssets}">
            <ListView.ItemContainerStyle>
                <Style TargetType="ListViewItem">
                    <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                </Style>
            </ListView.ItemContainerStyle>
            <ListView.ItemTemplate>
                <DataTemplate x:DataType="data:ItemData">
                    <Grid Margin="0 0 2 0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <TextBox Text="{Binding number, Mode=TwoWay}" GotFocus="textBoxGotFocus" LostFocus="itemNumberLostFocus"/>
                        <TextBlock Text="{Binding name, Mode=OneWay}" VerticalAlignment="Center" Grid.Column="1" Margin="15 0 0 0"/>
                        <TextBox Text="{Binding sum, Mode=TwoWay}" GotFocus="textBoxGotFocus" LostFocus="sumLostFocus" Grid.Column="2" HorizontalAlignment="Right" Width="120" TextAlignment="Right"/>
                    </Grid>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
    </Grid>
</Page>
4

0 回答 0