Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 6 > C# 6 General Discussion
C# 6 General Discussion Discussions about the C# 6 language and tools not related to any specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 6 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 6th, 2017, 09:31 AM
Registered User
Join Date: Apr 2017
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Cool change binding at runtime

I have not touched C# in years and low and behold it has drastically changed.
I am working on a small project and I am looking for help for the following scenario:

the following listbox is bound to an XML file that is included into the project at design time in XAML.

<ListBox x:Name="LbAud" ItemsSource="{Binding Source={StaticResource XmlData}, XPath=Terms/Audience}" HorizontalAlignment="Left" Margin="99,142,0,0" VerticalAlignment="Top" Width="350" Height="68"/>
What I would like to do is to rebind the came control to a different XML file based on a user's choice.

All told I have 3 independent XML files, that contain similar information and I would like to reuse the same existing listboxes and procedures for any of those files. just switch the binding of the various listboxes to different XML files.

For your information, there will be 5 listboxes that depending on the user's choice load from different xml files

I was thinking initially of creating 15 listboxes and hiding/showing them depending on the user's choice, but that seems to be a waste of resources.
So instead i want to re-utilize the same boxes and populate from different lists.

All is coded in C# XAML (which is new to me) and should run in a WPF environment.

I appreciate your help

Similar Threads
Thread Thread Starter Forum Replies Last Post
Crystal Report for visual studio 2010, How to change header text at runtime using C# samio2008 BOOK: Professional Crystal Reports for VS.NET 0 August 29th, 2011 09:54 AM
Change web config at runtime louisa68 ASP.NET 3.5 Basics 23 February 23rd, 2009 06:57 AM
binding GridView at runtime! veda Visual Studio 2005 3 August 4th, 2008 06:44 AM
Change datasource of crystal report at runtime check123 Pro VB 6 1 March 21st, 2008 05:45 AM
How to change an ASP: Image Url at runtime ergaurav.nex ASP.NET 1.0 and 1.1 Professional 2 September 5th, 2006 03:44 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.