Click here to Skip to main content
15,888,521 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: WPF Control - Enter Key Pin
Mycroft Holmes20-May-13 12:31
professionalMycroft Holmes20-May-13 12:31 
AnswerRe: WPF Control - Enter Key Pin
AlphaDeltaTheta20-May-13 15:12
AlphaDeltaTheta20-May-13 15:12 
GeneralRe: WPF Control - Enter Key Pin
NortonC20-May-13 23:38
NortonC20-May-13 23:38 
GeneralRe: WPF Control - Enter Key Pin
AlphaDeltaTheta21-May-13 14:38
AlphaDeltaTheta21-May-13 14:38 
QuestionMVVM vs. MVVMP Pin
sthotakura20-May-13 0:45
sthotakura20-May-13 0:45 
AnswerRe: MVVM vs. MVVMP Pin
SledgeHammer0120-May-13 5:01
SledgeHammer0120-May-13 5:01 
AnswerRe: MVVM vs. MVVMP Pin
Abhinav S24-May-13 22:11
Abhinav S24-May-13 22:11 
QuestionDatabinding a ListBox using MVVM light (Windows Phone) Pin
jockey4her19-May-13 12:30
jockey4her19-May-13 12:30 
Using the default MVVM light project for Windows Phone, I tried to implement a databinding to a ListBox. Unsuccessfully. The same CS code, placed in the normal code behind seems to bind just fine. But over in the view model, I get nothing but a blank box.

HTML
<ListBox x:Name="myListBox" HorizontalAlignment="Left" Height="100"
     VerticalAlignment="Top" Width="200">
    <ListBox.ItemTemplate>
        <DataTemplate>
            <ItemsControl ItemsSource="{Binding theList}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal" Width="auto">
                            <TextBlock Text="{Binding Path=Key}" />
                            <TextBlock Text="{Binding Path=Value}" />
                        </StackPanel>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>


C#
public Dictionary<string, string> theDictionary;
private List<Dictionary<string, string>> _theList;
public const string theListPropertyName = "theList";
public List<Dictionary<string, string>> theList
{
    get
    {
        return _theList;
    }
    set
    {
        if (_theList == value)
            return;
        _theList = value;
        RaisePropertyChanged(theListPropertyName);
    }
}
public MainViewModel(IDataService dataService)
{
    List<Dictionary<string, string>> x = new List<Dictionary<string, string>>();
    theDictionary = new Dictionary<string, string>();
    theDictionary.Add("1", "A");
    theDictionary.Add("2", "B");
    theList = new List<Dictionary<string, string>>();
    theList.Add(theDictionary);

}

AnswerRe: Databinding a ListBox using MVVM light (Windows Phone) Pin
AlphaDeltaTheta19-May-13 14:51
AlphaDeltaTheta19-May-13 14:51 
GeneralRe: Databinding a ListBox using MVVM light (Windows Phone) Pin
jockey4her19-May-13 15:42
jockey4her19-May-13 15:42 
GeneralRe: Databinding a ListBox using MVVM light (Windows Phone) Pin
AlphaDeltaTheta19-May-13 16:08
AlphaDeltaTheta19-May-13 16:08 
GeneralRe: Databinding a ListBox using MVVM light (Windows Phone) Pin
jockey4her19-May-13 17:07
jockey4her19-May-13 17:07 
GeneralRe: Databinding a ListBox using MVVM light (Windows Phone) Pin
AlphaDeltaTheta20-May-13 15:08
AlphaDeltaTheta20-May-13 15:08 
QuestionWPF datagrid text alignment in columns Pin
elelont216-May-13 23:53
elelont216-May-13 23:53 
AnswerRe: WPF datagrid text alignment in columns Pin
Pete O'Hanlon17-May-13 0:33
mvePete O'Hanlon17-May-13 0:33 
GeneralRe: WPF datagrid text alignment in columns Pin
elelont217-May-13 2:16
elelont217-May-13 2:16 
GeneralRe: WPF datagrid text alignment in columns Pin
Pete O'Hanlon17-May-13 2:31
mvePete O'Hanlon17-May-13 2:31 
QuestionNew Table to an existing Silverlight project Pin
picasso216-May-13 19:36
picasso216-May-13 19:36 
QuestionWPF motion path animation on controls Pin
usmankai16-May-13 14:10
usmankai16-May-13 14:10 
QuestionMust compile XAML file that specifies events Pin
Neo1010115-May-13 23:29
Neo1010115-May-13 23:29 
AnswerRe: Must compile XAML file that specifies events Pin
AlphaDeltaTheta18-May-13 16:42
AlphaDeltaTheta18-May-13 16:42 
GeneralRe: Must compile XAML file that specifies events Pin
Neo1010119-May-13 4:23
Neo1010119-May-13 4:23 
GeneralRe: Must compile XAML file that specifies events Pin
AlphaDeltaTheta19-May-13 14:48
AlphaDeltaTheta19-May-13 14:48 
QuestionIs Frame is a good Control for loading a Xaml page in WPF? Pin
Mohammed Hameed14-May-13 19:53
professionalMohammed Hameed14-May-13 19:53 
AnswerRe: Is Frame is a good Control for loading a Xaml page in WPF? Pin
Abhinav S15-May-13 8:12
Abhinav S15-May-13 8:12 

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.