Click here to Skip to main content
15,886,026 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: How can I Bind a DataTemplate Slider definition to the Code behind? Pin
maycockt14-Dec-12 1:18
maycockt14-Dec-12 1:18 
QuestionHow does one define IOleServiceProvider in a C# WPF application? Pin
Xarzu10-Dec-12 3:54
Xarzu10-Dec-12 3:54 
AnswerRe: How does one define IOleServiceProvider in a C# WPF application? Pin
Pete O'Hanlon10-Dec-12 4:08
mvePete O'Hanlon10-Dec-12 4:08 
QuestionSetting icons based on Region/city name?! Pin
radkrish9-Dec-12 19:43
radkrish9-Dec-12 19:43 
AnswerRe: Setting icons based on Region/city name?! Pin
Abhinav S9-Dec-12 20:12
Abhinav S9-Dec-12 20:12 
QuestionWPF ComboBox Selected Item Problem Pin
Kevin Marois8-Dec-12 10:48
professionalKevin Marois8-Dec-12 10:48 
AnswerRe: WPF ComboBox Selected Item Problem Pin
Ninja__Turtle8-Dec-12 17:43
Ninja__Turtle8-Dec-12 17:43 
AnswerRe: WPF ComboBox Selected Item Problem Pin
Wayne Gaylard8-Dec-12 18:24
professionalWayne Gaylard8-Dec-12 18:24 
If you want your combobox to automatically select the employee's type, then you need to set the SelectedValue and SelectedValuePath properties as well, something like this :-
XML
<ComboBox Grid.Row="2"
            Grid.Column="1"
            Width="120"
            HorizontalAlignment="Left"
            SelectedValue="{Binding Path=SelecetdEmployee.SelecetdEmployeeType.EmpoyeeTypeID}"
            SelecetdValuePath="EmployeeTypeID"
            ItemsSource="{Binding EmployeeTypes}"
            SelectedItem="{Binding SelectedEmployeeType, Mode=TwoWay}">
                
    <ComboBox.ItemTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding Caption}">
                <TextBlock.ToolTip>
                    <StackPanel Orientation="Vertical">
                        <TextBlock Text="{Binding Caption}"
                                    FontWeight="Bold"/>
                        <TextBlock Text="{Binding Description}"/>
                    </StackPanel>
                </TextBlock.ToolTip>
            </TextBlock>
        </DataTemplate>
    </ComboBox.ItemTemplate>
                
</ComboBox>


Just note that it is important to set the SelectedValue and SelectedValuePath properties before setting the ItemsSource property for the bindings to work properly.

Hope this helps
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman

GeneralRe: WPF ComboBox Selected Item Problem Pin
Kevin Marois8-Dec-12 19:37
professionalKevin Marois8-Dec-12 19:37 
GeneralRe: WPF ComboBox Selected Item Problem Pin
Kevin Marois8-Dec-12 19:37
professionalKevin Marois8-Dec-12 19:37 
GeneralRe: WPF ComboBox Selected Item Problem Pin
Wayne Gaylard8-Dec-12 19:39
professionalWayne Gaylard8-Dec-12 19:39 
QuestionAt commands Pin
Pranay Dabholkar7-Dec-12 5:56
Pranay Dabholkar7-Dec-12 5:56 
AnswerRe: At commands Pin
Abhinav S9-Dec-12 20:14
Abhinav S9-Dec-12 20:14 
QuestionCurrency Converter Pin
pjank427-Dec-12 5:44
pjank427-Dec-12 5:44 
AnswerRe: Currency Converter Pin
Pete O'Hanlon7-Dec-12 6:58
mvePete O'Hanlon7-Dec-12 6:58 
GeneralRe: Currency Converter Pin
pjank427-Dec-12 7:38
pjank427-Dec-12 7:38 
QuestionWPF Binding TextBox to Dependency Property Pin
g_ap5-Dec-12 1:02
g_ap5-Dec-12 1:02 
AnswerRe: WPF Binding TextBox to Dependency Property Pin
Richard Deeming5-Dec-12 2:53
mveRichard Deeming5-Dec-12 2:53 
Questionhighlight list view - is--moueOver Pin
dominioYP3-Dec-12 10:07
dominioYP3-Dec-12 10:07 
AnswerRe: highlight list view - is--moueOver Pin
SledgeHammer013-Dec-12 11:52
SledgeHammer013-Dec-12 11:52 
QuestionWPF DrawingContext DrawText bug??? Pin
subakaev2-Dec-12 21:09
subakaev2-Dec-12 21:09 
GeneralRe: WPF DrawingContext DrawText bug??? Pin
TheIndra23-Nov-20 12:34
TheIndra23-Nov-20 12:34 
QuestionHow do you stop a WebBrowser object in WPF? Pin
Xarzu2-Dec-12 4:25
Xarzu2-Dec-12 4:25 
AnswerRe: How do you stop a WebBrowser object in WPF? Pin
Richard MacCutchan2-Dec-12 4:54
mveRichard MacCutchan2-Dec-12 4:54 
QuestionHow do you stop a WebBrowser object in WPF? Pin
Xarzu2-Dec-12 3:53
Xarzu2-Dec-12 3:53 

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.