简体   繁体   English

设计器视图未显示组标题

[英]Designer view not showing Group headers

I have a problem with group header in the Visual Studio 2015 designer. 我在Visual Studio 2015设计器中的组标题有问题。 The group header do show up in while running my Windows 10 UWP app. 运行Windows 10 UWP应用程序时,组标题确实会显示在其中。

I have the following XAML: 我有以下XAML:

<RelativePanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <ListView x:Name="TracksOverview"
              IsItemClickEnabled="True"
              ItemsSource="{Binding Source={StaticResource TracksOverviewSource}}"
              ItemTemplate="{StaticResource TrackOverview}"
              RelativePanel.AlignBottomWithPanel="True" 
              RelativePanel.AlignTopWithPanel="True"
              RelativePanel.AlignLeftWithPanel="True">
        <ListView.GroupStyle>
            <GroupStyle>
                <GroupStyle.HeaderTemplate>
                    <DataTemplate>
                        <TextBlock Text="1900-2000"
                                   Foreground="White" />
                    </DataTemplate>
                </GroupStyle.HeaderTemplate>
            </GroupStyle>
        </ListView.GroupStyle>
    </ListView>
</RelativePanel>

I've taken a screenshot of my designer and of my program. 我已经截取了我的设计师和程序的屏幕截图。

屏幕截图

As you can see the header doesn't show up int the designer view (left) but does while running (right). 如您所见,标题不会在设计器视图中显示(左),而在运行时显示(右)。

First I thought there is something wrong with my binding but, it doesn't even show the static text, it does reserve some space for it. 首先,我认为我的绑定有问题,但是,它甚至不显示静态文本,但确实为它保留了一些空间。

Thanks in advance, Rick 预先感谢,里克

First of all, if it works as expected while running, I wouldn't worry about header not showing up in design mode. 首先,如果它在运行时能按预期工作,则我不会担心标题不会在设计模式下显示。 However, if you want to see your design-time values displayed, then you need to look into setting the design-time data context with d: prefixes (eg, d:DataContext for relevant controls) and design-time attributes. 但是,如果要查看显示的设计时值,则需要考虑使用d:前缀(例如,相关控件的d:DataContext)和设计时属性来设置设计时数据上下文。

During design time, the Designer displays whatever it can evaluate while leaving out the ones it can't (like the Header in your case), which means you need to supply design time values. 在设计时,Designer将显示它可以评估的所有内容,而忽略不评估的内容(例如您的标题),这意味着您需要提供设计时的值。 As a counter-argument, do you really want to devote time to populating design-time values when you know it works with real data? 作为反驳,当您知道设计时间值可用于实际数据时,您是否真的想花费时间来填充设计时间值? Design-time display has its purpose such as showing as close a replica UI of a working system. 设计时显示具有其目的,例如将工作系统的副本UI显示为紧密。 If this is not the aim I wouldn't worry about it. 如果这不是目标,那么我就不用担心。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM