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

WPF

 
GeneralRe: Passing two parameters in Command biding in WPF and MVVM Pin
Meshack Musundi23-May-16 3:12
professionalMeshack Musundi23-May-16 3:12 
QuestionAdd Dictionary in ObsavableCollection Pin
indian14314-May-16 9:20
indian14314-May-16 9:20 
AnswerRe: Add Dictionary in ObsavableCollection Pin
Pete O'Hanlon14-May-16 22:07
mvePete O'Hanlon14-May-16 22:07 
AnswerRe: Add Dictionary in ObsavableCollection Pin
Richard Deeming16-May-16 1:18
mveRichard Deeming16-May-16 1:18 
GeneralRe: Add Dictionary in ObsavableCollection Pin
indian14316-May-16 6:35
indian14316-May-16 6:35 
QuestionDatagrid is not updating the values after changing the collection in the ViewModel in WPF Pin
indian14313-May-16 11:02
indian14313-May-16 11:02 
AnswerRe: Datagrid is not updating the values after changing the collection in the ViewModel in WPF Pin
Richard Deeming13-May-16 11:16
mveRichard Deeming13-May-16 11:16 
GeneralRe: Datagrid is not updating the values after changing the collection in the ViewModel in WPF Pin
indian14313-May-16 11:44
indian14313-May-16 11:44 
Hi,

I did that (I have added NotifyPropertyChanged method in the AddAnItem() method) still my Datagrid is not getting updated according to the collection change.
public void AddAnItem()
{
    int t = DictionaryName.Keys.Max() + 1;
    DictionaryName.Add((short)t, t + "Number");
    NotifyPropertyChanged("DictionaryName");
}
My NotitfyProertyChanged method is written as below, do I have any error in there?
private void NotifyPropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (null != handler)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
The value in the TextBox is getting added to the DictionaryName collection but is not getting displayed into the DataGrid, I tried all sorts of options, but didn't work.
<Window x:Class="TestWPFApplication.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525"
        xmlns:local="using:TestWPFApplication">
    <Grid>
        <Label Content="Enter Name" HorizontalAlignment="Left" Margin="58,62,0,0" VerticalAlignment="Top" Name="lblName"/>
        <TextBox Text="{Binding Name, Mode=OneTime}"  HorizontalAlignment="Left" Height="22" Margin="160,64,0,0" TextWrapping="Wrap" Name="txtName" VerticalAlignment="Top" Width="120"/>
        <Button Content="Save" HorizontalAlignment="Left" Margin="180,142,0,0" VerticalAlignment="Top" Width="74" Name="btnSave"
                Command="{Binding Path=TestCommand}"/>
        <Button Content="Save Specific" HorizontalAlignment="Left" Margin="277,142,0,0" VerticalAlignment="Top" Width="74" Name="btnSaveSpecific"
                Command="{Binding Path=TestSpecificCommand}"
                CommandParameter="{Binding ElementName=txtName, Path=Text}" />
        <DataGrid HorizontalAlignment="Left" Margin="103,188,0,0" VerticalAlignment="Top" Height="98" Width="313" 
                  ItemsSource="{Binding Path=DictionaryName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" AutoGenerateColumns="True" >

<pre>
    </DataGrid>

</Grid>




Anybody please help me man, even suggestion just to execute this is also fine.
Thanks,

Abdul Aleem

"There is already enough hatred in the world lets spread love, compassion and affection."


modified 13-May-16 19:48pm.

GeneralRe: Datagrid is not updating the values after changing the collection in the ViewModel in WPF Pin
indian14313-May-16 21:09
indian14313-May-16 21:09 
GeneralRe: Datagrid is not updating the values after changing the collection in the ViewModel in WPF Pin
Pete O'Hanlon14-May-16 3:39
mvePete O'Hanlon14-May-16 3:39 
QuestionConvert This XAML To C# Pin
Kevin Marois12-May-16 13:45
professionalKevin Marois12-May-16 13:45 
QuestionAdd a check box and delete multiple rows from DataGrid in WPF Pin
indian14312-May-16 8:46
indian14312-May-16 8:46 
AnswerRe: Add a check box and delete multiple rows from DataGrid in WPF Pin
Mycroft Holmes12-May-16 13:06
professionalMycroft Holmes12-May-16 13:06 
GeneralRe: Add a check box and delete multiple rows from DataGrid in WPF Pin
indian14312-May-16 14:12
indian14312-May-16 14:12 
QuestionUse Different Paths In Control Template Pin
Kevin Marois11-May-16 13:14
professionalKevin Marois11-May-16 13:14 
AnswerRe: Use Different Paths In Control Template Pin
Gerry Schmitz11-May-16 16:06
mveGerry Schmitz11-May-16 16:06 
QuestionHandle Title Bar Icon Click Pin
Kevin Marois11-May-16 5:56
professionalKevin Marois11-May-16 5:56 
AnswerRe: Handle Title Bar Icon Click Pin
CHill6011-May-16 22:42
mveCHill6011-May-16 22:42 
AnswerRe: Handle Title Bar Icon Click Pin
Pete O'Hanlon11-May-16 23:50
mvePete O'Hanlon11-May-16 23:50 
Questionwpf Pin
Member 113037949-May-16 7:39
Member 113037949-May-16 7:39 
AnswerRe: wpf Pin
Pete O'Hanlon9-May-16 8:34
mvePete O'Hanlon9-May-16 8:34 
QuestionRe: wpf Pin
ZurdoDev11-May-16 9:20
professionalZurdoDev11-May-16 9:20 
QuestionWPF Dependency Property Of Type UserControl Pin
Kevin Marois3-May-16 5:32
professionalKevin Marois3-May-16 5:32 
QuestionUse TTF Font From Resources Pin
Kevin Marois28-Apr-16 12:13
professionalKevin Marois28-Apr-16 12:13 
AnswerRe: Use TTF Font From Resources Pin
Richard Deeming29-Apr-16 2:18
mveRichard Deeming29-Apr-16 2:18 

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.