我是Windows开发的新手。我目前正在设计一个活动页面,我需要根据日期创建一个事件列表。
public class Appointment
{
public string DateTime{get; set;}
public Appointments Data {get; set;}
}
public class Appointments
{
public string UserName {get; set;}
public string VisitorFor {get; set;}
}
将列表传递给前端事件以生成视图。 视图应如下:[h] [d1] [d2] [d3] [h2] [d1] [d2] [h3] [d1] ... [h(n)] [d(n)]。 Aimed model
列表应水平显示数据,列表的标题必须与图像一样。如何在同一水平线上显示标题和内容。?
目标平台是Windows 8.1应用程序。
评论后更新了代码
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused">
<Storyboard></Storyboard>
</VisualState>
<VisualState x:Name="Unfocused" />
<VisualState x:Name="PointerFocused" />
</VisualStateGroup>
<VisualStateGroup x:Name="SelectionStates">
<VisualState x:Name="Unselected">
<Storyboard>
<ColorAnimation Duration="0" Storyboard.TargetName="myback" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" To="Transparent"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Selected">
<Storyboard>
<ColorAnimation Duration="0" Storyboard.TargetName="myback" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" To="Gray"/>
</Storyboard>
</VisualState>
<VisualState x:Name="SelectedUnfocused">
<Storyboard>
<ColorAnimation Duration="0" Storyboard.TargetName="myback" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" To="Transparent"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border x:Name="myback" Background="Transparent">
<ContentPresenter Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate>
<Textblock Text="{Binding EventsObj.Value.UserName}"/>
<Textblock Text="{Binding EventsObj.Value.VisitorFor}"/>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.HeaderTemplate>
<DataTemplate>
<Grid Margin="5,10,0,10" Background="Black">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="68*"/>
<ColumnDefinition Width="21*"/>
</Grid.ColumnDefinitions>
<TextBlock Foreground="White"
RenderTransformOrigin="0.5,0.5" FontSize="20" Grid.ColumnSpan="2" UseLayoutRounding="False" d:LayoutRounding="Auto" Text="{Binding EventsObj.Key}">
<TextBlock.RenderTransform>
<RotateTransform Angle="270"/>
</TextBlock.RenderTransform>
</TextBlock>
</Grid>
</DataTemplate>
</ListView.HeaderTemplate>
物件
public class Appointment
{
public Dictionary<DateTime, List<Appointments>> Data {get; set;}
}
public class Appointments
{
public string UserName {get; set;}
public string VisitorFor {get; set;}
}