Click here to Skip to main content
15,903,012 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: How to Set RadProgress bar on method load Pin
Mycroft Holmes3-Dec-13 18:53
professionalMycroft Holmes3-Dec-13 18:53 
QuestionPass values between windows Pin
shers2-Dec-13 6:35
shers2-Dec-13 6:35 
AnswerRe: Pass values between windows Pin
Elman905-Dec-13 23:02
Elman905-Dec-13 23:02 
AnswerRe: Pass values between windows Pin
Andy41120-Dec-13 2:36
Andy41120-Dec-13 2:36 
Questionhow to access cell template control's in listview in wpf Pin
dharmaa.m1-Dec-13 7:20
dharmaa.m1-Dec-13 7:20 
AnswerRe: how to access cell template control's in listview in wpf Pin
Mycroft Holmes1-Dec-13 11:48
professionalMycroft Holmes1-Dec-13 11:48 
GeneralRe: how to access cell template control's in listview in wpf Pin
dharmaa.m1-Dec-13 22:03
dharmaa.m1-Dec-13 22:03 
AnswerRe: how to access cell template control's in listview in wpf Pin
Varsha Ramnani1-Dec-13 23:15
professionalVarsha Ramnani1-Dec-13 23:15 
GeneralRe: how to access cell template control's in listview in wpf Pin
dharmaa.m2-Dec-13 0:32
dharmaa.m2-Dec-13 0:32 
GeneralRe: how to access cell template control's in listview in wpf Pin
Varsha Ramnani2-Dec-13 1:10
professionalVarsha Ramnani2-Dec-13 1:10 
QuestionHow to send the parent name when we click on chlid Pin
Ashfaque Hussain29-Nov-13 3:41
Ashfaque Hussain29-Nov-13 3:41 
QuestionCreate two window by silverlight for windows embeded compact7 os Pin
yingkou21-Nov-13 2:09
yingkou21-Nov-13 2:09 
AnswerRe: Create two window by silverlight for windows embeded compact7 os Pin
Mycroft Holmes21-Nov-13 11:48
professionalMycroft Holmes21-Nov-13 11:48 
GeneralRe: Create two window by silverlight for windows embeded compact7 os Pin
yingkou23-Nov-13 18:02
yingkou23-Nov-13 18:02 
QuestionTrouble with MultiTrigger and IsMouseOver property Pin
t2b18-Nov-13 10:28
t2b18-Nov-13 10:28 
QuestionScroll Bar is not showing Pin
Ashfaque Hussain18-Nov-13 1:56
Ashfaque Hussain18-Nov-13 1:56 
AnswerRe: Scroll Bar is not showing Pin
t2b19-Nov-13 1:22
t2b19-Nov-13 1:22 
GeneralRe: Scroll Bar is not showing Pin
Ashfaque Hussain19-Nov-13 2:30
Ashfaque Hussain19-Nov-13 2:30 
GeneralRe: Scroll Bar is not showing Pin
t2b19-Nov-13 19:57
t2b19-Nov-13 19:57 
QuestionDisplaying border after adding Opacity mask for the image Pin
gourav852412-Nov-13 20:31
gourav852412-Nov-13 20:31 
AnswerRe: Displaying border after adding Opacity mask for the image Pin
RedDk16-Nov-13 11:00
RedDk16-Nov-13 11:00 
QuestionCombobox data wont update WPF MVVM Pin
LiquidHolic12-Nov-13 16:18
LiquidHolic12-Nov-13 16:18 
I have 2 pages (User and UserListing) When I Add new user on User Page then change page to UserListing Page the ComboBoxUser on UserListing Page wont update automatically. Any Idea to solve this ?

this is my code User.cs
C#
public class User : INotifyPropertyChanged
{
    string _firstName;
    public string FirstName {
        get { return _firstName; }
        set { 
            _firstName = value;
            OnPropertyChanged("FirstName");
            OnPropertyChanged("FullName");
        }
    }

    string _lastName;
    public string LastName {
        get { return _lastName; }
        set { 
            _lastName = value;
            OnPropertyChanged("LastName");
            OnPropertyChanged("FullName");
        }
    }

    public string FullName
    {
        get { return string.Format("{0} {1}", FirstName, LastName); }
    }

    int _gender;
    public int Gender {
        get { return _gender; }
        set { 
            _gender = value;
            OnPropertyChanged("Gender");
        }
    }

    public event PropertyChangedEventHandler PropertyChanged;

    protected void OnPropertyChanged(string name)
    {
        PropertyChangedEventHandler handler = PropertyChanged;
        if (handler != null)
        {
            handler(this, new PropertyChangedEventArgs(name));
        }
    }
}


UserListingViewModel.cs
C#
public class UserListingViewModel : INotifyPropertyChanged
{
    public UserListingViewModel()
    {
        LoadDataUser();
    }

    public void LoadDataUser()
    {
        ComboUserData = new ObservableCollection<User>();

        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings[
            "dLondre.Properties.Settings.CSLONDRE"].ConnectionString);

        string str = "";
        str += "SELECT userid,firstname + ' ' + lastname as name FROM [user] ";

        SqlCommand com = con.CreateCommand();
        com.CommandText = str;

        try
        {
            con.Open();
            SqlDataReader sdr = com.ExecuteReader();
            while (sdr.Read())
            {
                ComboUserData.Add(new User { UserID = (string)sdr["userid"], FirstName = (string)sdr["name"]});
            }

            com.Dispose();
            con.Close();
            con.Dispose();
        }
        catch (Exception e)
        {
            Console.WriteLine(e);
        }
    }


    ObservableCollection<User> _comboUserData;
    public ObservableCollection<User> ComboUserData
    {
        get
        {
            if (_comboUserData == null)
                _comboUserData = new ObservableCollection<User>();
            return _comboUserData;
        }
        set
        {
            if (value != _comboUserData)
                _comboUserData = value;
            OnPropertyChanged("ComboUserData");
        }
    }

    User _user;
    public User SelectedUserID
    {
        get { return _user; }
        set
        {
            _user = value;
            OnPropertyChanged("SelectedUserID");
        }
    }
}


XAML
XML
<ComboBox x:Name="DDUserId" 
     Width="140" 
     DisplayMemberPath="FirstName" 
     IsSynchronizedWithCurrentItem="True" 
     ItemsSource="{Binding ComboUserData,Mode=TwoWay}" 
     SelectedItem="{Binding SelectedUserID}">
</ComboBox>

AnswerRe: Combobox data wont update WPF MVVM Pin
karthikeyal8712-Nov-13 22:58
karthikeyal8712-Nov-13 22:58 
GeneralRe: Combobox data wont update WPF MVVM Pin
LiquidHolic13-Nov-13 2:09
LiquidHolic13-Nov-13 2:09 
GeneralRe: Combobox data wont update WPF MVVM Pin
SledgeHammer0113-Nov-13 4:53
SledgeHammer0113-Nov-13 4: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.