Click here to Skip to main content
15,912,932 members
Home / Discussions / WPF
   

WPF

 
QuestionHow to show SSL WCF Service Padlock Pin
Soulforged8-Oct-09 13:48
Soulforged8-Oct-09 13:48 
AnswerRe: How to show SSL WCF Service Padlock Pin
Nigel Ferrissey8-Oct-09 14:22
Nigel Ferrissey8-Oct-09 14:22 
GeneralRe: How to show SSL WCF Service Padlock Pin
Soulforged8-Oct-09 15:31
Soulforged8-Oct-09 15:31 
GeneralRe: How to show SSL WCF Service Padlock Pin
Nigel Ferrissey8-Oct-09 16:15
Nigel Ferrissey8-Oct-09 16:15 
GeneralRe: How to show SSL WCF Service Padlock Pin
Soulforged8-Oct-09 16:49
Soulforged8-Oct-09 16:49 
GeneralRe: How to show SSL WCF Service Padlock Pin
Nigel Ferrissey8-Oct-09 18:07
Nigel Ferrissey8-Oct-09 18:07 
QuestionDynemic Data binding for image within ListBox Pin
grvdarji8-Oct-09 10:40
grvdarji8-Oct-09 10:40 
AnswerRe: Dynemic Data binding for image within ListBox Pin
Gideon Engelberth9-Oct-09 3:32
Gideon Engelberth9-Oct-09 3:32 
GeneralRe: Dynemic Data binding for image within ListBox Pin
grvdarji9-Oct-09 6:20
grvdarji9-Oct-09 6:20 
GeneralRe: Dynemic Data binding for image within ListBox Pin
Gideon Engelberth9-Oct-09 13:25
Gideon Engelberth9-Oct-09 13:25 
Questionround slider Pin
robotz8-Oct-09 4:57
robotz8-Oct-09 4:57 
AnswerRe: round slider Pin
Christian Graus8-Oct-09 9:41
protectorChristian Graus8-Oct-09 9:41 
GeneralRe: round slider Pin
robotz8-Oct-09 9:58
robotz8-Oct-09 9:58 
GeneralRe: round slider Pin
Christian Graus8-Oct-09 10:26
protectorChristian Graus8-Oct-09 10:26 
GeneralRe: round slider Pin
robotz8-Oct-09 10:32
robotz8-Oct-09 10:32 
QuestionMedia element fullscreen Pin
Nekkantidivya7-Oct-09 19:29
Nekkantidivya7-Oct-09 19:29 
AnswerRe: Media element fullscreen Pin
Nigel Ferrissey8-Oct-09 16:03
Nigel Ferrissey8-Oct-09 16:03 
QuestionCalling SSL WCF Service from Silverlight Pin
Soulforged7-Oct-09 15:47
Soulforged7-Oct-09 15:47 
AnswerRe: Calling SSL WCF Service from Silverlight Pin
Nigel Ferrissey7-Oct-09 19:19
Nigel Ferrissey7-Oct-09 19:19 
GeneralRe: Calling SSL WCF Service from Silverlight Pin
Soulforged8-Oct-09 13:41
Soulforged8-Oct-09 13:41 
AnswerRe: Calling SSL WCF Service from Silverlight Pin
Mark Salsbery8-Oct-09 10:19
Mark Salsbery8-Oct-09 10:19 
QuestionSelector (ListBox, ComboBox) default selected item woes when bound to ObservableCollection Pin
Jeremy Likness7-Oct-09 10:32
professionalJeremy Likness7-Oct-09 10:32 
AnswerRe: Selector (ListBox, ComboBox) default selected item woes when bound to ObservableCollection Pin
Nigel Ferrissey8-Oct-09 12:08
Nigel Ferrissey8-Oct-09 12:08 
Hi Jeremy,

One way could be to have a property in the ViewModel like this:

private int _selectedIndex = -1;
public int SelectedIndex
{
    get { return _selectedIndex; }
    set
    {
        if (value != _selectedIndex)
        {
            _selectedIndex = value;
            NotifyPropertyChanged("SelectedIndex");
        }
     }
}


It's set to -1 initially so the XAML doesn't throw an error when there's no collection to bind to.

Bind it to the list box:

<ListBox ItemsSource="{Binding Employees}" SelectedIndex="{Binding SelectedIndex}" />


Then, in the completed event (when the service returns from the asynchronous call with the data) you can set it to whatever you want.

void svcClient_GetDataCompleted(object sender, EmployeeSvc.GetDataCompletedEventArgs e)
{
    Employees = e.Result;
    SelectedIndex = 1;
}


Not particularly elegant, but it seems to work.

Cheers.
QuestionCan DataGrid Swap Row and Column? Pin
Frank W. Wu7-Oct-09 10:13
Frank W. Wu7-Oct-09 10:13 
AnswerRe: Can DataGrid Swap Row and Column? Pin
Nigel Ferrissey9-Oct-09 12:22
Nigel Ferrissey9-Oct-09 12:22 

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.