仅将DataTemplate应用于一种类型

时间:2017-05-05 21:23:10

标签: c# wpf data-binding listbox

我正在尝试仅将datatemplate应用于SECTION .data prompt: db "Enter a positive integer: " plen: equ $-prompt SECTION .bss inbuf: resb 20 inbuf2: resb 20 SECTION .text global _start _start: ; Here I am grabbing the two integers to use in the function nop mov eax, 4 ; write mov ebx, 1 ; to standard output mov ecx, prompt ; the prompt string mov edx, plen ; of length plen int 80H ; interrupt with the syscall mov eax, 3 ; read mov ebx, 0 ; from standard input mov ecx, inbuf ; into the input buffer mov edx, 30 ; upto 30 bytes int 80H ; interrupt with the syscall mov eax, 4 ; write mov ebx, 1 ; to standard output mov ecx, prompt ; the prompt string mov edx, plen ; of length plen int 80H ; interrupt with the syscall mov eax, 3 ; read mov ebx, 0 ; from standard input mov ecx, inbuf2 ; into the input buffer mov edx, 30 ; upto 30 bytes int 80H ; interrupt with the syscall 类型。但它也会在Genre之后应用于List<string>。如何Search_ClickListBox申请DataTemplate数据?

Genre

代码隐藏:

<DataTemplate x:Key="genreTemplate" DataType="{x:Type local:Genre}">
    <Border BorderBrush="Green" BorderThickness="2">
        <StackPanel Margin="4">
            <TextBlock
                FontSize="20"
                Foreground="Red"
                Text="{Binding Name}"
                TextAlignment="Center" />
            <TextBlock
                FontSize="16"
                Text="{Binding Count}"
                TextAlignment="Right" />
        </StackPanel>
    </Border>

 </DataTemplate>

public class Genre { public string Name { get; set; } public int Count { get; set; } public double Size { get; set; } public string Drive { get; set; } } private void Search_Click(object sender, RoutedEventArgs e) { var path = Constants.allMoviesPath; var ext = new List<string> { @".txt", @".ini", @".exe", @".mob", @".srt", @".ass" }; lstBox.ItemsSource = Directory.GetFiles(path, "*" + SearchString + "*", SearchOption.AllDirectories) .Where(f => !ext.Contains(System.IO.Path.GetExtension(f))) .Select(f => System.IO.Path.GetFileNameWithoutExtension(f)) .ToList(); } private void btnStats_Click(object sender, RoutedEventArgs e) { lstBox.ItemsSource = FileLists.MoviesCountSizeStats(); } 的返回类型为MoviesCountSizeStats()

List<Genre>

0 个答案:

没有答案