Click here to Skip to main content
15,881,757 members
Home / Discussions / C#
   

C#

 
QuestionPlaying with Enumerations Pin
ezazazel22-Sep-09 0:45
ezazazel22-Sep-09 0:45 
AnswerRe: Playing with Enumerations Pin
harold aptroot22-Sep-09 0:54
harold aptroot22-Sep-09 0:54 
AnswerRe: Playing with Enumerations Pin
Gideon Engelberth22-Sep-09 2:51
Gideon Engelberth22-Sep-09 2:51 
GeneralRe: Playing with Enumerations Pin
ezazazel22-Sep-09 6:49
ezazazel22-Sep-09 6:49 
AnswerRe: Playing with Enumerations Pin
PIEBALDconsult22-Sep-09 4:07
mvePIEBALDconsult22-Sep-09 4:07 
GeneralRe: Playing with Enumerations Pin
ezazazel22-Sep-09 6:47
ezazazel22-Sep-09 6:47 
GeneralRe: Playing with Enumerations Pin
PIEBALDconsult22-Sep-09 13:52
mvePIEBALDconsult22-Sep-09 13:52 
QuestionGetting data from a Listbox controlled by WPF and XML Pin
reg.orton22-Sep-09 0:24
reg.orton22-Sep-09 0:24 
Hi there,
I am quite new to C# and WPF especially. I have a form, with 2 listboxes on. The first looks up an xml file and gets some data items (themes), the next listbox is bound to the first, and gets some data (scenes) from inside the selected theme tag.

This works wonderfully.

I would now like to get the value of an element (FreeStyleCue) and use that in a c# function tied to the OnSelectionChanged handler.

However I cant work out for the life of me how to get the information from the FreeStyleCue tag.

Can anyone help me??

Here is the xml file.


<?xml version="1.0" encoding="utf-8" ?><br />
<themes><br />
  <theme name="Yellow" description="A yellow theme" order="1"><br />
    <scene name="PreShow" order ="1"><br />
      <description>For before the show yellow.</description><br />
      <FreeStyleCue>y12</FreeStyleCue><br />
    </scene><br />
    <scene name="Scenex" order ="1"><br />
      <description>During yellow show</description><br />
      <FreeStyleCue>y122</FreeStyleCue><br />
    </scene><br />
  </theme><br />
  <theme name="Blue" description="A blue theme" order="1"><br />
    <scene name="PreShow" order ="1"><br />
      <description>For before the show</description><br />
      <FreeStyleCue>b12</FreeStyleCue><br />
    </scene><br />
    <scene name="Scene1" order ="1"><br />
      <description>During Show</description><br />
      <FreeStyleCue>b122</FreeStyleCue><br />
    </scene><br />
  </theme><br />
</themes><br />


Here is the WPF XAML file

<Window x:Class="WpfApplication1.Window1"<br />
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"<br />
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"<br />
Title="Window1" Height="400" Width="800"><br />
    <Window.Resources><br />
<br />
        <XmlDataProvider x:Key="AllThemes" XPath="themes" Source="testdata.xml" /><br />
        <br />
        <br />
        <DataTemplate x:Key="dtThemes"><br />
           <br />
                <StackPanel FlowDirection="LeftToRight" Orientation="Vertical"><br />
<br />
                    <TextBlock Text="{Binding XPath=@name}" FontSize="15" /><br />
                    <TextBlock Text="{Binding XPath=@description}" /><br />
<br />
                </StackPanel><br />
           <br />
        </DataTemplate><br />
        <br />
        <br />
        <DataTemplate x:Key="dtScenes"><br />
            <StackPanel FlowDirection="LeftToRight" Orientation="Vertical"><br />
<br />
                <TextBlock Text="{Binding XPath=@name}" FontSize="15" /><br />
                <TextBlock Text="{Binding XPath=description}" /><br />
                <TextBlock Text="{Binding XPath=FreeStyleCue}" /><br />
                <br />
            </StackPanel><br />
        </DataTemplate><br />
<br />
<br />
<br />
    </Window.Resources><br />
<br />
<br />
<br />
    <Grid Name="gMain"><br />
        <Grid.ColumnDefinitions><br />
            <ColumnDefinition Width="123" /><br />
            <ColumnDefinition Width="8"/><br />
            <ColumnDefinition Width="*" /><br />
        </Grid.ColumnDefinitions><br />
        <br />
        <Menu Grid.Column="0" Grid.ColumnSpan="3"></Menu><br />
<br />
        <ListBox Name="listboxTheme" <br />
             ItemsSource="{Binding Source={StaticResource AllThemes}, XPath=theme}"<br />
             ItemTemplate="{StaticResource dtThemes}" HorizontalAlignment="Left" Width="123"><br />
        </ListBox><br />
<br />
        <GridSplitter Grid.Column="1"></GridSplitter><br />
<br />
        <StackPanel Grid.ColumnSpan="2" Margin="6,0,6,0" Grid.Column="1"><br />
            <ListBox Name="listboxScenes" <br />
                 ItemsSource="{Binding ElementName=listboxTheme, Path=SelectedItem, UpdateSourceTrigger=PropertyChanged}"                      <br />
                 ItemTemplate="{StaticResource dtScenes}" Height="650" SelectionChanged="listboxScenes_SelectionChanged"><br />
         <br />
            </ListBox><br />
        </StackPanel><br />
<br />
    </Grid><br />
</Window><br />


and the code that is asking for the data

<br />
 private void listboxScenes_SelectionChanged(object sender, SelectionChangedEventArgs e)<br />
        {<br />
            <br />
            <br />
            SelectQueueInFS(SelectionID); //this is where i am stuck!!! <br />
        }<br />
<br />

AnswerRe: Getting data from a Listbox controlled by WPF and XML Pin
vivasaayi22-Sep-09 19:37
vivasaayi22-Sep-09 19:37 
GeneralRe: Getting data from a Listbox controlled by WPF and XML Pin
reg.orton23-Sep-09 3:37
reg.orton23-Sep-09 3:37 
QuestionHow to insert javascript funtion dynamically ? Pin
Jacobb Michael21-Sep-09 23:38
Jacobb Michael21-Sep-09 23:38 
AnswerRe: How to insert javascript funtion dynamically ? Pin
Amit Patel198521-Sep-09 23:49
Amit Patel198521-Sep-09 23:49 
GeneralRe: How to insert javascript funtion dynamically ? Pin
Jacobb Michael21-Sep-09 23:52
Jacobb Michael21-Sep-09 23:52 
AnswerRe: How to insert javascript funtion dynamically ? Pin
Amit Patel198522-Sep-09 0:03
Amit Patel198522-Sep-09 0:03 
GeneralRe: How to insert javascript funtion dynamically ? Pin
Jacobb Michael22-Sep-09 0:10
Jacobb Michael22-Sep-09 0:10 
Questionhow to Collect selected text in the richtextbox Pin
amir-haghighi21-Sep-09 22:40
amir-haghighi21-Sep-09 22:40 
AnswerRe: how to Collect selected text in the richtextbox Pin
SummerBulb21-Sep-09 23:18
SummerBulb21-Sep-09 23:18 
AnswerRe: how to Collect selected text in the richtextbox Pin
OriginalGriff21-Sep-09 23:29
mveOriginalGriff21-Sep-09 23:29 
GeneralRe: how to Collect selected text in the richtextbox Pin
amir-haghighi22-Sep-09 5:33
amir-haghighi22-Sep-09 5:33 
GeneralRe: how to Collect selected text in the richtextbox Pin
OriginalGriff22-Sep-09 6:05
mveOriginalGriff22-Sep-09 6:05 
GeneralRe: how to Collect selected text in the richtextbox Pin
amir-haghighi27-Oct-09 0:33
amir-haghighi27-Oct-09 0:33 
Question[Message Deleted] Pin
ShaktisinhRathod21-Sep-09 22:15
ShaktisinhRathod21-Sep-09 22:15 
AnswerRe: Invalid Argument in Word.Document.SaveAS(,,) Interop.Microsoft.Office.Core.dll Pin
OriginalGriff21-Sep-09 23:19
mveOriginalGriff21-Sep-09 23:19 
General[Message Deleted] Pin
ShaktisinhRathod22-Sep-09 0:39
ShaktisinhRathod22-Sep-09 0:39 
GeneralRe: Invalid Argument in Word.Document.SaveAS(,,) Interop.Microsoft.Office.Core.dll Pin
OriginalGriff22-Sep-09 0:49
mveOriginalGriff22-Sep-09 0:49 

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.