Click here to Skip to main content
15,881,715 members
Home / Discussions / WPF
   

WPF

 
Question901130 - Image is not displayed Pin
ilostmyid218-Feb-12 21:59
professionalilostmyid218-Feb-12 21:59 
AnswerRe: 901130 - Image is not displayed Pin
ilostmyid220-Feb-12 21:42
professionalilostmyid220-Feb-12 21:42 
AnswerRe: 901130 - Image is not displayed Pin
Pete O'Hanlon21-Feb-12 2:49
mvePete O'Hanlon21-Feb-12 2:49 
QuestionResource Dictionary Question Pin
Kevin Marois17-Feb-12 14:40
professionalKevin Marois17-Feb-12 14:40 
QuestionBest Design Approach For This App Pin
Kevin Marois15-Feb-12 14:46
professionalKevin Marois15-Feb-12 14:46 
AnswerRe: Best Design Approach For This App Pin
SledgeHammer0116-Feb-12 7:32
SledgeHammer0116-Feb-12 7:32 
GeneralRe: Best Design Approach For This App Pin
Kevin Marois16-Feb-12 7:43
professionalKevin Marois16-Feb-12 7:43 
QuestionSet Combo SelectedItem In DataTemplate Pin
Kevin Marois15-Feb-12 5:30
professionalKevin Marois15-Feb-12 5:30 
I'm not totally sure how to ask this question, so bear with me...

I have a data template for a list of ProjectEntities displayed in a ListBox. A ProjectEntity has ProjectName and ProjectType properties, both string.

So far, my data template contains a hyperlink for the ProjectName and a combobox populated with a list of ProjectType. I have the combobox itemsource set in the template, it it's populating fine.

But how do I set the combo box selected item on the selected listbox item? In other words, on each instance of a ProjectEntity, I need to know what combobox value was selected.

Here's my XAML so far:

<DataTemplate DataType="{x:Type entities:ProjectEntity}">
    <StackPanel Orientation="Horizontal"
                Margin="2">
        <Image Source="/Falcon.WPF;component/Media/Images/project_256.png"
                Height="16"
                Width="16"
                Margin="0,0,2,0"/>

        <TextBlock Margin="2,0,0,0"
                    Width="200">
            <Hyperlink NavigateUri="{Binding ProjectName}"
                        Foreground="RoyalBlue"
                        Command="{Binding Path=DataContext.SelectedProjectCommand, 
                                    RelativeSource={RelativeSource FindAncestor, AncestorType={ x:Type views:ClientListView}}}"
                        CommandParameter="{Binding}">
                <InlineUIContainer>
                    <TextBlock Text="{Binding ProjectName}" />
                </InlineUIContainer>
                <Hyperlink.Style>     
                    <Style TargetType="Hyperlink">       
                        <Style.Triggers>         
                            <Trigger Property="IsMouseOver" Value="False">
                                <Setter Property="TextDecorations" Value="{x:Null}" />         
                            </Trigger>       
                        </Style.Triggers>     
                    </Style>   
                </Hyperlink.Style> 

            </Hyperlink>
        </TextBlock>
        <ComboBox ItemsSource="{Binding Path=DataContext.ProjectTypes, 
                        RelativeSource={RelativeSource FindAncestor, AncestorType={ x:Type views:ClientListView}}}"
                    Width="100"/>
    </StackPanel>
</DataTemplate>

Everything makes sense in someone's mind

AnswerRe: Set Combo SelectedItem In DataTemplate Pin
SledgeHammer0115-Feb-12 8:05
SledgeHammer0115-Feb-12 8:05 
GeneralRe: Set Combo SelectedItem In DataTemplate Pin
Kevin Marois15-Feb-12 15:48
professionalKevin Marois15-Feb-12 15:48 
GeneralRe: Set Combo SelectedItem In DataTemplate Pin
SledgeHammer0116-Feb-12 7:25
SledgeHammer0116-Feb-12 7:25 
QuestionTrying to use the VisualStateManager Pin
Super Lloyd15-Feb-12 2:04
Super Lloyd15-Feb-12 2:04 
QuestionStoring Data on Server or Client in SilverLight4 Pin
idreesbadshah14-Feb-12 23:48
idreesbadshah14-Feb-12 23:48 
AnswerRe: Storing Data on Server or Client in SilverLight4 Pin
Abhinav S14-Feb-12 23:52
Abhinav S14-Feb-12 23:52 
GeneralRe: Storing Data on Server or Client in SilverLight4 Pin
idreesbadshah14-Feb-12 23:56
idreesbadshah14-Feb-12 23:56 
GeneralRe: Storing Data on Server or Client in SilverLight4 Pin
Pete O'Hanlon15-Feb-12 1:35
mvePete O'Hanlon15-Feb-12 1:35 
GeneralRe: Storing Data on Server or Client in SilverLight4 Pin
idreesbadshah15-Feb-12 2:16
idreesbadshah15-Feb-12 2:16 
GeneralRe: Storing Data on Server or Client in SilverLight4 Pin
Pete O'Hanlon15-Feb-12 2:29
mvePete O'Hanlon15-Feb-12 2:29 
QuestionWPF Handling Events In MVVM Pin
Kevin Marois14-Feb-12 10:44
professionalKevin Marois14-Feb-12 10:44 
AnswerRe: WPF Handling Events In MVVM Pin
SledgeHammer0114-Feb-12 11:02
SledgeHammer0114-Feb-12 11:02 
GeneralRe: WPF Handling Events In MVVM Pin
Kevin Marois14-Feb-12 11:21
professionalKevin Marois14-Feb-12 11:21 
GeneralRe: WPF Handling Events In MVVM Pin
Kevin Marois14-Feb-12 11:53
professionalKevin Marois14-Feb-12 11:53 
GeneralRe: WPF Handling Events In MVVM Pin
SledgeHammer0114-Feb-12 11:56
SledgeHammer0114-Feb-12 11:56 
GeneralRe: WPF Handling Events In MVVM Pin
Kevin Marois14-Feb-12 12:01
professionalKevin Marois14-Feb-12 12:01 
GeneralRe: WPF Handling Events In MVVM Pin
SledgeHammer0114-Feb-12 12:05
SledgeHammer0114-Feb-12 12:05 

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.