or
public partial class Window1 : Window
{
Entities entities;
PARENT parent;
bool saved = false;
public Window1()
{
InitializeComponent();
entities = new Entities();
parent = PARENT.CreatePARENT(Guid.NewGuid().ToString(), "00000");
gridViewChild.ItemsSource = parent.Child;
}
private void buttonOk_Click(object sender, RoutedEventArgs e)
{
entities.SaveChanges();
}
private void buttonCancel_Click(object sender, RoutedEventArgs e)
{
}
private void tabItemParent_LostFocus(object sender, RoutedEventArgs e)
{
if (!saved)
{
// Create the parent
parent.FIRST_NAME = this.textBoxFirstName.Text;
parent.LAST_NAME = this.textBoxLastName.Text;
parent.MIDDLE_NAME = this.textBoxMiddleName.Text;
parent.ZIP = this.textBoxZipCode.Text;
entities.AddToPARENT(parent);
saved = true;
}
}
private void gridViewChild_AddingNewDataItem(object sender, Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs e)
{
// Entity Framework supports identity (server side generated) keys but we
// must provide a default key value first.
CHILD child = CHILD.CreateCHILD(0, "Test");
parent.ChildProfile.Add(child);
e.NewObject = child;
}
}
|
| DataMemberBinding="{Binding Path=AAA.BBB.CCC}" |
I want to do the following which I can do with most of the itemcollections in the ms toolbox.
I want to be able to bind a custom property on an object to the SelectedProperty of a row in a gridview. The result would be that you could select multiple rows in a gridview and then each of the objects in the list that the Grid was bound to would have their IsSelectedProperty set to true.
Example of TreeView:
So each TreeViewItem IsSelected property is bound to the bound objects IsSelectedProperty.
<
Style x:Key="{x:Type TreeViewItem}" TargetType="{x:Type TreeViewItem}">
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
....
....
</Style>
Is this possible with the GridView?
Thanks,
| <UserControl.Resources> |
| <cur:AssumedLevelToColour x:Key="convAssumedLevel"/> |
| <Style x:Key="assumedLevelStyle" TargetType="{x:Type telerik:GridViewCell}"> |
| <Setter Property="Background"> |
| <Setter.Value> |
| <SolidColorBrush Color="{Binding Path=AssumedLevel, Converter={StaticResource convAssumedLevel}}" /> |
| </Setter.Value> |
| </Setter> |
| </Style> |
| </UserControl.Resources> |
| <telerik:RadGridView Margin="6,6,6,6" MaxHeight="1000" Name="lstDefenders" Grid.ColumnSpan="3" SelectionChanged="lstDefenders_SelectionChanged" telerik:StyleManager.Theme="Vista" IsReadOnly="True" RowIndicatorVisibility="Collapsed" AutoGenerateColumns="False" ColumnsWidthMode="Auto" MultipleSelect="True" > |
| <telerik:RadGridView.Columns> |
| <telerik:GridViewDataColumn HeaderText="Manufacturer" DataMemberBinding="{Binding Manufacturer, Mode=OneWay}" /> |
| <telerik:GridViewDataColumn HeaderText="Product" DataMemberBinding="{Binding Name, Mode=OneWay}" /> |
| <telerik:GridViewDataColumn CellStyle="{StaticResource assumedLevelStyle}" HeaderText="Assumed Level" DataMemberBinding="{Binding AssumedLevel, Mode=OneWay}" /> |
| <telerik:GridViewDataColumn HeaderText="Type" DataMemberBinding="{Binding Type, Mode=OneWay}" /> |
| <telerik:GridViewDataColumn HeaderText="Approval" DataMemberBinding="{Binding Approval, Mode=OneWay}" /> |
| <telerik:GridViewDataColumn HeaderText="Notes" DataMemberBinding="{Binding Notes, Mode=OneWay}" /> |
| </telerik:RadGridView.Columns> |
| </telerik:RadGridView> |