Click here to Skip to main content
15,909,835 members
Home / Discussions / WPF
   

WPF

 
QuestionWPF App - different page than StartupUri getting called... Pin
Phil Boyd30-Jun-10 10:34
Phil Boyd30-Jun-10 10:34 
AnswerRe: WPF App - different page than StartupUri getting called... Pin
Pete O'Hanlon30-Jun-10 10:46
mvePete O'Hanlon30-Jun-10 10:46 
AnswerRe: WPF App - different page than StartupUri getting called... Pin
BechBej5-Jul-10 9:45
BechBej5-Jul-10 9:45 
QuestionProblem with Binding to XML in WPF. [Resolved] Pin
Henry Minute30-Jun-10 9:34
Henry Minute30-Jun-10 9:34 
AnswerRe: Problem with Binding to XML in WPF. Pin
Pete O'Hanlon30-Jun-10 10:44
mvePete O'Hanlon30-Jun-10 10:44 
GeneralRe: Problem with Binding to XML in WPF. Pin
Henry Minute30-Jun-10 11:31
Henry Minute30-Jun-10 11:31 
GeneralRe: Problem with Binding to XML in WPF. Pin
Pete O'Hanlon30-Jun-10 11:45
mvePete O'Hanlon30-Jun-10 11:45 
GeneralRe: Problem with Binding to XML in WPF. Pin
Henry Minute30-Jun-10 13:00
Henry Minute30-Jun-10 13:00 
Thanks for your help Pete!

Between that and a little experimentation I have managed to get it working.

Just in case you are interested, here's the code:
<Window x:Class="Binding_to_XML_File.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <StackPanel>
        <StackPanel.Resources>
            <XmlDataProvider x:Key="Colours" XPath="/colours" Source="Colours.xml" />
            <XmlDataProvider x:Key="MoreColours" XPath="/colours">
                <x:XData>
                    <colours xmlns="">
                        <colour name="pink" primary="true"/>
                        <colour name="white" primary="false"/>
                        <colour name="black" primary="true"/>
                        <colour name="cyan" primary="false"/>
                        <colour name="gray" primary="true"/>
                        <colour name="magenta" primary="false"/>
                    </colours>
                </x:XData>
            </XmlDataProvider>
        </StackPanel.Resources>
        <TextBlock Width="248" Height="24" Margin="0, 5, 0, 0" Text="Colours:" TextWrapping="Wrap"/>
        <ListBox x:Name="lboxColour" Width="248" Height="56" Margin="0,0,0,3" IsSynchronizedWithCurrentItem="True"
                 ItemsSource="{Binding Source={StaticResource Colours}, XPath=colour/@name}">
        </ListBox>
        <TextBlock Width="248" Height="24" Margin="0,5,0,0" Text="You selected colour:"/>
        <TextBlock Width="248" Height="24" Text="{Binding ElementName=lboxColour, Path=SelectedValue, Mode=OneWay}" 
                   Background="{Binding ElementName=lboxColour, Path=SelectedValue, Mode=OneWay}"/>
    </StackPanel>
</Window>


Now by changing ItemsSource="{Binding Source={StaticResource Colours}, XPath=colour/@name}" to ItemsSource="{Binding Source={StaticResource MoreColours}, XPath=colour/@name}" I can use the file or embedded XML
Henry Minute

Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
Why do programmers often confuse Halloween and Christmas? - Because 31 Oct = 25 Dec.
Business Myths of the Geek #4 'What you think matters.'

GeneralRe: Problem with Binding to XML in WPF. Pin
Pete O'Hanlon30-Jun-10 21:47
mvePete O'Hanlon30-Jun-10 21:47 
GeneralRe: Problem with Binding to XML in WPF. Pin
Pete O'Hanlon1-Jul-10 11:58
mvePete O'Hanlon1-Jul-10 11:58 
GeneralRe: Problem with Binding to XML in WPF. Pin
Henry Minute1-Jul-10 12:12
Henry Minute1-Jul-10 12:12 
GeneralRe: Problem with Binding to XML in WPF. Pin
Pete O'Hanlon1-Jul-10 12:13
mvePete O'Hanlon1-Jul-10 12:13 
QuestionHow to install silverlight Pin
yogesh_kumar_agarwal29-Jun-10 19:39
yogesh_kumar_agarwal29-Jun-10 19:39 
AnswerRe: How to install silverlight Pin
Abhinav S29-Jun-10 20:13
Abhinav S29-Jun-10 20:13 
GeneralRe: How to install silverlight Pin
souidi abderrahman29-Jun-10 21:54
souidi abderrahman29-Jun-10 21:54 
GeneralRe: How to install silverlight Pin
Abhinav S1-Jul-10 20:12
Abhinav S1-Jul-10 20:12 
GeneralRe: How to install silverlight Pin
souidi abderrahman1-Jul-10 20:53
souidi abderrahman1-Jul-10 20:53 
AnswerRe: How to install silverlight Pin
Kunal Chowdhury «IN»30-Jun-10 1:03
professionalKunal Chowdhury «IN»30-Jun-10 1:03 
AnswerRe:How to install silverlight Pin
Ch.Gayatri Subudhi1-Jul-10 18:19
Ch.Gayatri Subudhi1-Jul-10 18:19 
QuestionApply two animations to a text block simultanously Pin
WBurgMo29-Jun-10 16:00
WBurgMo29-Jun-10 16:00 
AnswerRe: Apply two animations to a text block simultanously Pin
Insincere Dave1-Jul-10 9:10
Insincere Dave1-Jul-10 9:10 
GeneralRe: Apply two animations to a text block simultanously Pin
WBurgMo1-Jul-10 10:35
WBurgMo1-Jul-10 10:35 
QuestionDetecting the CellText,Selected length, Cursor position on edit mode in WPF datagrid. Pin
kartheesh29-Jun-10 4:19
kartheesh29-Jun-10 4:19 
AnswerRe: Detecting the CellText,Selected length, Cursor position on edit mode in WPF datagrid. Pin
Abhinav S29-Jun-10 20:30
Abhinav S29-Jun-10 20:30 
AnswerRe: Detecting the CellText,Selected length, Cursor position on edit mode in WPF datagrid. Pin
Pete O'Hanlon29-Jun-10 22:15
mvePete O'Hanlon29-Jun-10 22:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.