xaml 中使用xml类型数据

当时很好奇在xaml中如何使用xml类型数据,看到一个很好的示例,然后就copy下来:

<Window.Resources>
        <XmlDataProvider x:Key="xmlData" XPath="colors/colora">
            <x:XData>
                <colors xmlns="">
                    <colora ID="233">233</colora>
                </colors>
            </x:XData>
        </XmlDataProvider>
    </Window.Resources>
    <StackPanel DataContext="{Binding Source={StaticResource xmlData}}">
        <Label Content="{Binding XPath=@ID}" />
        <Slider  Maximum="255"
                 Minimum="0"
                 Value="{Binding Mode=TwoWay, UpdateSourceTrigger=PropertyChanged,
            XPath=@ID}" x:Name="ColorSliderA"/>
    </StackPanel>

原文地址:https://www.cnblogs.com/shen119/p/3419535.html