Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Add controls with XML data

$
0
0

I have a user control that I have in a StackPanel within my MainWindow and I want to add X number of these controls using an XML file.

<StackPanel  DataContext="{Binding Source={StaticResource HydraDataSource}}"  ><local:ButtonSlider x:Name="SliderButton1" ButtonText="{Binding XPath=DSPEngine/Process/@Name}" LabelText="{Binding XPath=DSPEngine/Process/@Metric}" SliderMax="{Binding XPath=DSPEngine/Process/@Max}" SliderMin="{Binding XPath=DSPEngine/Process/@Min}" SliderValue="{Binding XPath=DSPEngine/Process/@Value}" Height="80" Width="155"/></StackPanel>

The ButtonSlider user control properties are populated using the XML data attributes for each node.

Could someone help me out with the code behind for my MainWindow showing how I would read the xml data and add more controls at startup?


Jeff Davis


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>