小编Jit*_*dav的帖子

如何将Date转换为String formate.

可能重复:
如何计算相对时间?

我想将日期值转换为字符串格式,就像YouTube视频上传时间或日期格式一样.2年前或1个月前或8个月前这样的假设我只有简单的日期作为输出.

谢谢..!!

c#

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

如何在ListView SelectedItem中创建样式.?

我正在开发一个WPF应用程序,我想打开样式ListViewItem.我已经为此制作了一个风格,但这并没有给出我想要的确切结果.除此之外,我想要CornerRadius这种风格,以便我可以添加这个?

            <ListView x:Name="MenuBarList" 
                    Grid.Row="1"
                    Height="{Binding MainMenuHeight}"  
                    Width="{Binding MainMenuWidth}" 
                    ItemsSource="{Binding Path=Menu.Options}" 
                    SelectedItem="{Binding Path=SelectedMainMenuOption, Mode=TwoWay}"
                    Foreground="White"
                    Background="Transparent" 
                    VerticalContentAlignment="Center"
                    HorizontalContentAlignment="Center"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    IsSynchronizedWithCurrentItem="True"
                    IsTabStop="False">

                <ListView.Style>
                    <Style TargetType="{x:Type ListView}">
                        <Setter Property="BorderBrush" Value="White"/>
                        <Setter Property="BorderThickness" Value="0"/>
                        <Setter Property="Margin" Value="0"/> 
                        <Setter Property="Width" Value="300"/>
                        <Style.Resources>
                            <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#9449b0"/>
                            <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="#9449b0"/>
                    </Style.Resources>
                    </Style>
                </ListView.Style>


                <ListView.ItemTemplate>
                    <DataTemplate>

                        <StackPanel Orientation="Horizontal" Focusable="False" VerticalAlignment="Center" HorizontalAlignment="Center">
                            <Image Source="{Binding IconPath}" 
                                   Focusable="False"
                                   HorizontalAlignment="Center"
                                   VerticalAlignment="Center"
                                   IsHitTestVisible="False"/>

                            <TextBlock Text="{Binding Title}" 
                                       Focusable="False" 
                                       HorizontalAlignment="Center" 
                                       VerticalAlignment="Center" 
                                       FontFamily="Segoe UI"
                                       FontSize="26"
                                       IsHitTestVisible="False"/>
                        </StackPanel>
                </DataTemplate>

                </ListView.ItemTemplate> …
Run Code Online (Sandbox Code Playgroud)

wpf listview styles

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

标签 统计

c# ×1

listview ×1

styles ×1

wpf ×1