Click here to Skip to main content
15,890,185 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Free hand Line Pin
Pete O'Hanlon5-Mar-09 2:37
mvePete O'Hanlon5-Mar-09 2:37 
GeneralRe: Free hand Line Pin
ABitSmart5-Mar-09 2:45
ABitSmart5-Mar-09 2:45 
QuestionWPF language issue Please help very urgnet Pin
psdeepu4-Mar-09 16:51
psdeepu4-Mar-09 16:51 
AnswerRe: WPF language issue Please help very urgnet Pin
ABitSmart4-Mar-09 17:06
ABitSmart4-Mar-09 17:06 
AnswerRe: WPF language issue Please help very urgnet Pin
Wes Aday4-Mar-09 17:11
professionalWes Aday4-Mar-09 17:11 
QuestionSimple general Data binding question - Changing Collection reference Pin
dartrax4-Mar-09 15:08
dartrax4-Mar-09 15:08 
AnswerRe: Simple general Data binding question - Changing Collection reference Pin
ABitSmart4-Mar-09 16:02
ABitSmart4-Mar-09 16:02 
AnswerRe: Simple general Data binding question - Changing Collection reference Pin
Eslam Afifi4-Mar-09 16:29
Eslam Afifi4-Mar-09 16:29 
Use the System.ComponentModel.INotifyPropertyChanged interface.
Let class A
class A : INotifyPropertyChanged
{
    List<string> _list;
    public List<string> List
    {
        get
        {
            return _list;
        }
        set
        {
            _list = value;
            NotifyPropertyChanged("List");
        }
    }

    private void NotifyPropertyChanged(string propertyName)
    {
        if (PropertyChanged != null)
            PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    }

    public event PropertyChangedEventHandler PropertyChanged;
}


a window
<Window x:Class="WpfApplication1.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <StackPanel>
        <ListBox ItemsSource="{Binding List}" />
        <Button Click="Button_Click" Content="Change reference" />
    </StackPanel>
</Window>

with a code behind containing
public partial class Window1 : Window
{
    A _a;

    public Window1()
    {
        InitializeComponent();

        _a = new A();
        _a.List = new List<string>
        {
            "a",
            "b",
            "c",
            "d",
            "e",
        };
        this.DataContext = _a;
    }

    private void Button_Click(object sender, RoutedEventArgs e)
    {
        _a.List = new List<string>()
        {
            "0",
            "1",
            "2",
            "3",
            "4",
            "5",
            "6",
            "7",
            "8",
            "9",
        };
    }
}


Eslam Afifi

GeneralRe: Simple general Data binding question - Changing Collection reference Pin
ABitSmart4-Mar-09 16:56
ABitSmart4-Mar-09 16:56 
GeneralRe: Simple general Data binding question - Changing Collection reference Pin
Eslam Afifi4-Mar-09 17:21
Eslam Afifi4-Mar-09 17:21 
GeneralRe: Simple general Data binding question - Changing Collection reference Pin
ABitSmart4-Mar-09 17:44
ABitSmart4-Mar-09 17:44 
GeneralRe: Simple general Data binding question - Changing Collection reference Pin
Eslam Afifi4-Mar-09 17:56
Eslam Afifi4-Mar-09 17:56 
GeneralGREAT!! Thank you! Pin
dartrax5-Mar-09 1:46
dartrax5-Mar-09 1:46 
GeneralRe: GREAT!! Thank you! Pin
Eslam Afifi5-Mar-09 3:23
Eslam Afifi5-Mar-09 3:23 
QuestionA user control from a n0ob Pin
2hdass4-Mar-09 11:36
2hdass4-Mar-09 11:36 
AnswerRe: A user control from a n0ob Pin
Ravi Bhavnani4-Mar-09 11:59
professionalRavi Bhavnani4-Mar-09 11:59 
GeneralRe: A user control from a n0ob Pin
2hdass6-Mar-09 11:26
2hdass6-Mar-09 11:26 
QuestionBinding one DP to another across controls Pin
MBursill4-Mar-09 11:14
MBursill4-Mar-09 11:14 
AnswerRe: Binding one DP to another across controls Pin
ABitSmart4-Mar-09 16:48
ABitSmart4-Mar-09 16:48 
GeneralRe: Binding one DP to another across controls Pin
MBursill4-Mar-09 18:32
MBursill4-Mar-09 18:32 
GeneralRe: Binding one DP to another across controls Pin
ABitSmart4-Mar-09 18:33
ABitSmart4-Mar-09 18:33 
QuestionListBox DataItemTemplate And Multiple Object Types Pin
BlitzPackage4-Mar-09 6:07
BlitzPackage4-Mar-09 6:07 
AnswerRe: ListBox DataItemTemplate And Multiple Object Types Pin
Mark Salsbery4-Mar-09 7:37
Mark Salsbery4-Mar-09 7:37 
GeneralRe: ListBox DataItemTemplate And Multiple Object Types Pin
BlitzPackage4-Mar-09 7:51
BlitzPackage4-Mar-09 7:51 
GeneralRe: ListBox DataItemTemplate And Multiple Object Types Pin
Mark Salsbery4-Mar-09 8:15
Mark Salsbery4-Mar-09 8:15 

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.