Click here to Skip to main content
15,913,669 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: How to make Single instance application to run Pin
Joe Rozario4-Jul-10 18:27
Joe Rozario4-Jul-10 18:27 
GeneralRe: How to make Single instance application to run Pin
Pete O'Hanlon4-Jul-10 21:50
mvePete O'Hanlon4-Jul-10 21:50 
AnswerRe: How to make Single instance application to run Pin
BechBej4-Jul-10 13:05
BechBej4-Jul-10 13:05 
GeneralRe: How to make Single instance application to run Pin
Pete O'Hanlon4-Jul-10 21:49
mvePete O'Hanlon4-Jul-10 21:49 
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 
I am using C# Express 2010 on an XP box targeting .Net 4.0.

I have been following some examples from an article in MSDN Magazine[^]

At design time the ListBoxItems are visible, but at run time the ListBox is empty.

Here is the code, this is it, there's no code behind.

<StackPanel>
     <StackPanel.Resources>
         <XmlDataProvider x:Key="MoreColours" XPath="/colours">
             <x:XData>
                 <colours>
                     <colour name="pink"/>
                     <colour name="white"/>
                     <colour name="black"/>
                     <colour name="cyan"/>
                     <colour name="gray"/>
                     <colour name="magenta"/>
                 </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 MoreColours}, XPath=colour/@name}"/>
     <TextBlock Width="248" Height="24" Margin="0,5,0,0" Text="You selected colour:"/>
     <TextBlock Width="248" Height="24" Text="{Binding ElementName=lboxColour, Path=SelectedItem.Content, Mode=OneWay}"
                Background="{Binding ElementName=lboxColour, Path=SelectedItem.Content, Mode=OneWay}"/>
 </StackPanel>


The results are the same if I extract the XML to an external File, as here
<StackPanel>
    <StackPanel.Resources>
        <XmlDataProvider x:Key="Colours" Source="Colours.xml" XPath="/colours" />
    </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}"/>
    <TextBlock Width="248" Height="24" Margin="0,5,0,0" Text="You selected colour:"/>
    <TextBlock Width="248" Height="24" Text="{Binding ElementName=lboxColour, Path=SelectedItem.Content, Mode=OneWay}"
               Background="{Binding ElementName=lboxColour, Path=SelectedItem.Content, Mode=OneWay}"/>

</StackPanel>


Does anyone have any idea why this might be. I am pretty sure that I have the code as in the article and I have asked a few days ago at the address given in the article, but have had no reply.
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.'
modified on Wednesday, June 30, 2010 6:51 PM

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 
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 

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.