Click here to Skip to main content
15,905,679 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Timer Pin
Andy41111-Apr-12 2:37
Andy41111-Apr-12 2:37 
QuestionAnother WPF Styling Question Pin
Kevin Marois10-Apr-12 6:02
professionalKevin Marois10-Apr-12 6:02 
AnswerRe: Another WPF Styling Question Pin
Mycroft Holmes10-Apr-12 13:05
professionalMycroft Holmes10-Apr-12 13:05 
GeneralRe: Another WPF Styling Question Pin
Wes Aday10-Apr-12 13:27
professionalWes Aday10-Apr-12 13:27 
AnswerRe: Another WPF Styling Question Pin
Abhinav S10-Apr-12 21:23
Abhinav S10-Apr-12 21:23 
QuestionEventHandler for Pictrue Control in Windows Phone Pin
pix_programmer10-Apr-12 2:54
pix_programmer10-Apr-12 2:54 
AnswerRe: EventHandler for Pictrue Control in Windows Phone Pin
Pete O'Hanlon10-Apr-12 3:05
mvePete O'Hanlon10-Apr-12 3:05 
QuestionWPF, uncompiled XAML and scripting? Pin
Antonino Porcino9-Apr-12 21:26
Antonino Porcino9-Apr-12 21:26 
AnswerRe: WPF, uncompiled XAML and scripting? Pin
Abhinav S9-Apr-12 22:06
Abhinav S9-Apr-12 22:06 
GeneralRe: WPF, uncompiled XAML and scripting? Pin
Antonino Porcino9-Apr-12 22:19
Antonino Porcino9-Apr-12 22:19 
AnswerRe: WPF, uncompiled XAML and scripting? Pin
Mycroft Holmes10-Apr-12 0:53
professionalMycroft Holmes10-Apr-12 0:53 
GeneralRe: WPF, uncompiled XAML and scripting? Pin
Antonino Porcino10-Apr-12 2:12
Antonino Porcino10-Apr-12 2:12 
AnswerRe: WPF, uncompiled XAML and scripting? Pin
Wes Aday10-Apr-12 3:33
professionalWes Aday10-Apr-12 3:33 
GeneralRe: WPF, uncompiled XAML and scripting? Pin
Antonino Porcino10-Apr-12 7:07
Antonino Porcino10-Apr-12 7:07 
QuestionPRISM RaisePropertyChanged Pin
mi_n9-Apr-12 17:35
mi_n9-Apr-12 17:35 
QuestionBinding not initially filling in List of data Pin
Sutton Mehaffey9-Apr-12 7:32
Sutton Mehaffey9-Apr-12 7:32 
Questionboolean attached property Pin
michaelgr19-Apr-12 7:10
michaelgr19-Apr-12 7:10 
Question2 WPF Style Questions Pin
Kevin Marois9-Apr-12 7:09
professionalKevin Marois9-Apr-12 7:09 
AnswerRe: 2 WPF Style Questions Pin
Bernhard Hiller10-Apr-12 0:06
Bernhard Hiller10-Apr-12 0:06 
QuestionWPF 3D Pin
Kul_77-Apr-12 4:52
Kul_77-Apr-12 4:52 
AnswerRe: WPF 3D PinPopular
Wes Aday7-Apr-12 5:09
professionalWes Aday7-Apr-12 5:09 
AnswerRe: WPF 3D Pin
Abhinav S7-Apr-12 20:08
Abhinav S7-Apr-12 20:08 
GeneralRe: WPF 3D Pin
Kuldeep B8-Apr-12 1:29
Kuldeep B8-Apr-12 1:29 
GeneralRe: WPF 3D Pin
Kuldeep B8-Apr-12 1:40
Kuldeep B8-Apr-12 1:40 
QuestionLOOP THOUGH THE ROWS OF A TWO COLUMN WPF DATAGRID AND FORM A LIST COLLECTION WITH THE ELEMENTS Pin
Valentine 27-Apr-12 2:24
Valentine 27-Apr-12 2:24 
Hi. please am creating an application in which i created a list collection and successfully binded it to a datagrid. but the problem am having is to pull data back from the datagrid and use it to form the elements of the same list collection when a user clicks the SAVE button after making changes to the datagrid.
Thanks in advance.

the XAML is shown below:




<Grid Background="CornflowerBlue">
<DataGrid AutoGenerateColumns="False" Height="530" HorizontalAlignment="Left" Margin="12,12,0,0" Name="gridBeveragesAndJuices" VerticalAlignment="Top" Width="573"
HorizontalGridLinesBrush="Cyan" RowBackground="#FF12AD12" VerticalGridLinesBrush="Cyan" Foreground="Cyan" EnableColumnVirtualization="False"
EnableRowVirtualization="False" CanUserDeleteRows="True" CanUserAddRows="True" CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserResizeRows="False" CanUserSortColumns="False" AlternatingRowBackground="DodgerBlue" FontSize="13">
<DataGrid.Resources>
<Style TargetType="{x:Type DataGridColumnHeader}">
<Setter Property="Foreground" Value="DodgerBlue" />
<Setter Property="BorderBrush" Value="Yellow" />
</Style>
</DataGrid.Resources>
<DataGrid.Columns>
<DataGridTextColumn Width="287" Header=" ITEMS"
Binding="{Binding Path=ITEMS8, Mode=TwoWay, NotifyOnTargetUpdated=True}" x:Name="ItemsColumn" />
<DataGridTextColumn Width="286" Header=" PRICE"
Binding="{Binding Path=PRICE8, Mode=TwoWay, NotifyOnTargetUpdated=True}" x:Name="PriceColumn"/>
</DataGrid.Columns>
</DataGrid>
<Button Content="Cancel" Height="23" HorizontalAlignment="Left" Margin="67,578,0,0" Name="btnCancel" VerticalAlignment="Top" Width="75" />
<Button Content="Save" Height="23" HorizontalAlignment="Left" Margin="256,578,0,0" Name="btnSave" VerticalAlignment="Top" Width="75" Click="btnSave_Click" />
<Button Content="Exit" Height="23" HorizontalAlignment="Left" Margin="444,578,0,0" Name="btnExit" VerticalAlignment="Top" Width="75" />


</Grid>



And below is the code behind:



public partial class BeveragesAndJuices : Window
{
public BeveragesAndJuices()
{
InitializeComponent();
gridBeveragesAndJuices.ItemsSource = Source8;
}

public class Values8
{
public string ITEMS8 { get; set; }
public decimal PRICE8 { get; set; }


}


public List<Values8> Source8 = new List<Values8>
{
new Values8(){ITEMS8 = "Lacasera ", PRICE8 = 290}, new Values8(){ITEMS8 = "Cran-Orange Chiller ", PRICE8 = 290}, new Values8(){ITEMS8 = "Festive Fruity Flavored Milk ", PRICE8 = 290},
new Values8(){ITEMS8 = "Homemade Iced Coffee ", PRICE8 = 290}, new Values8(){ITEMS8 ="Lemon Cucumber Seltzer " , PRICE8 = 290}, new Values8(){ITEMS8 = "Fizzy Water ", PRICE8 = 290},
new Values8(){ITEMS8 ="Haunted (Black Cauldron) Punch " , PRICE8 = 290}, new Values8(){ITEMS8 ="Lemon Ginger Iced Green Tea " , PRICE8 = 290}, new Values8(){ITEMS8 ="Orange Creamsicle Shake " , PRICE8 = 290},
new Values8(){ITEMS8 = "Blueberry Blast Smoothie ", PRICE8 = 290}, new Values8(){ITEMS8 ="Shamrock Milk Mixer " , PRICE8 = 290}, new Values8(){ITEMS8 = "Pomegranate Punch ", PRICE8 = 290},
new Values8(){ITEMS8 ="anned Milo " , PRICE8 = 290}, new Values8(){ITEMS8 ="Viju Milk " , PRICE8 = 290}, new Values8(){ITEMS8 = "5 Alive ", PRICE8 = 290},
new Values8(){ITEMS8 ="Cherry Vanilla Smoothie " , PRICE8 = 290}, new Values8(){ITEMS8 = "Boysenberry-Banana Blast ", PRICE8 = 290}, new Values8(){ITEMS8 = "Vanilla Iced Mochaccino ", PRICE8 = 290},
new Values8(){ITEMS8 ="Choco-Nana Milk Mixer " , PRICE8 = 290}, new Values8(){ITEMS8 = "Fresh Fruit Pudding Milk Mixer ", PRICE8 = 290}, new Values8(){ITEMS8 ="Luscious Licuado " , PRICE8 = 290},
new Values8(){ITEMS8 = "Frosty Pine-Orange Yogurt Smoothie ", PRICE8 = 290}, new Values8(){ITEMS8 = "Mocha-ccino Freeze ", PRICE8 = 290}, new Values8(){ITEMS8 ="Lite Iced Mocha " , PRICE8 = 290},
new Values8(){ITEMS8 ="Nectarine Whirl " , PRICE8 = 290}, new Values8(){ITEMS8 ="Strawberries and Cream Smoothie " , PRICE8 = 290}, new Values8(){ITEMS8 ="Strawberry Light Lemonade " , PRICE8 = 290}
};

private void btnSave_Click(object sender, RoutedEventArgs e)
{
//clear the elements of the source

Source8.Clear();

//get the items on the datagrid and use them to form new elements of the
//Source8

foreach(DataGridRow Row in gridBeveragesAndJuices)
{
//this where am stuck, foreach flags an error
//that DataGridRow does not have a definition for GetEnumerator

}

}
}

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.