小编X-s*_*nin的帖子

C#将XML数据绑定到listview WPF

我经常搜索并尝试了很多,但我无法找出它为什么不起作用.我试图通过我的xaml中的数据绑定将XML文件输出到listview.

<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Kundenstrom"
        xmlns:Properties="clr-namespace:Kundenstrom.Properties" x:Class="Kundenstrom.MainWindow"
        mc:Ignorable="d"
        Title="Kundenstrom" Height="232.5" Width="631" Icon="Hopstarter-Sleek-Xp-Basic-User-Group.ico">
    <Window.Resources>
        <XmlDataProvider x:Key="Kundenstromdaten" Source="kunden.xml" XPath="Kundenstrom/Kunden"/>
    </Window.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="11*"/>
            <ColumnDefinition Width="77*"/>
            <ColumnDefinition Width="11*"/>
            <ColumnDefinition Width="40*"/>
            <ColumnDefinition Width="21*"/>
            <ColumnDefinition Width="357*"/>
        </Grid.ColumnDefinitions>
        <TabControl x:Name="tabControl" Grid.ColumnSpan="6" TabStripPlacement="Top" Margin="10,0,10,10">
            <TabItem Header="Eintragen">
                <Grid Background="#FFE5E5E5">
                    <TextBox x:Name="txtGrund" Height="44" Margin="10,10,10,0" TextWrapping="Wrap" VerticalAlignment="Top"/>
                    <ComboBox x:Name="cmbTyp1" HorizontalAlignment="Left" Margin="10,59,0,0" VerticalAlignment="Top" Width="287">
                        <ComboBoxItem Content="Laden"/>
                        <ComboBoxItem Content="Telefon"/>
                        <ComboBoxItem Content="Mail"/>
                    </ComboBox>
                    <ComboBox x:Name="cmbTyp2" Margin="302,58,10,0" VerticalAlignment="Top">
                        <ComboBoxItem Content="Anfrage"/>
                        <ComboBoxItem Content="Auftrag"/>
                        <ComboBoxItem Content="Abholung"/>
                    </ComboBox>
                    <Button x:Name="btnEintragen" Content="Eintragen" HorizontalAlignment="Left" Margin="10,86,0,0" VerticalAlignment="Top" …
Run Code Online (Sandbox Code Playgroud)

c# xml data-binding wpf

8
推荐指数
1
解决办法
790
查看次数

标签 统计

c# ×1

data-binding ×1

wpf ×1

xml ×1