Telerik Forums
UI for WPF Forum
4 answers
2.1K+ views
In my application I have a RadGridView and a Data Form. If I change the group or type of the DocumentTitle on the CombBox in Data Form, I get the following error message:

"The property 'Id' is part of the object's key information and cannot be modified."

XAML-Code (DataGrid):

01.<telerik:RadEntityFrameworkDataSource Name="DocumentTitlesDataSource" QueryName="DocumentTitles">
02. </telerik:RadEntityFrameworkDataSource>
03.  
04.            <telerik:RadGridView x:Name="Entries" Grid.Row="1"
05.                             ItemsSource="{Binding DataView, ElementName=DocumentTitlesDataSource}"
06.                             SelectedItem="{Binding DataView.CurrentItem, Mode=OneWay, ElementName=DocumentTitlesDataSource}"
07.                             SelectionMode="Single"
08.                             IsReadOnly="True"
09.                             AutoGenerateColumns="False"
10.                             IsSynchronizedWithCurrentItem="True"
11.                             CanUserDeleteRows="False"
12.                             CanUserFreezeColumns="False"
13.                             CanUserInsertRows="False"
14.                             CanUserReorderColumns="False"
15.                             CanUserResizeColumns="False"
16.                             CanUserSortColumns="False"
17.                             CanUserSortGroups="False"
18.                             IsFilteringAllowed="False"
19.                             ShowGroupPanel="False"
20.                             ShowColumnHeaders="False" SelectionChanging="Entries_SelectionChanging">
21.                <telerik:RadGridView.Columns>
22.                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Id}" Header="Id" Width="20" IsVisible="False"/>
23.                    <telerik:GridViewDataColumn DataMemberBinding="{Binding User.Id}" Header="Benutzer" Width="10" IsVisible="False"/>
24.                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Computer}" Header="Computer" Width="10" IsVisible="False"/>
25.                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Header="Dokumententitel" Width="*"/>
26.                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Group.Id}" Header="Dokumentengruppe" Width="200"/>
27.                    <telerik:GridViewComboBoxColumn x:Name="cbxDocumentTitleGroup" DataMemberBinding="{Binding Group.Id}"
28.                                                    DisplayMemberPath="Name"
29.                                                    SelectedValueMemberPath="Id"
30.                                                    Header="Dokumentengruppe"
31.                                                    Width="100"/>
32.                    <telerik:GridViewComboBoxColumn x:Name="cbxDocumentTitleType" DataMemberBinding="{Binding Type.Id}"
33.                                                    DisplayMemberPath="Name"
34.                                                    SelectedValueMemberPath="Id"
35.                                                    Header="Dokumententyp"
36.                                                    Width="100" />
37.                    <telerik:GridViewDataColumn DataMemberBinding="{Binding System}" Header="System" Width="10" IsVisible="False"/>
38.                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Locked}" Header="Gesperrt" Width="10" IsVisible="False"/>
39.                </telerik:RadGridView.Columns>
40.            </telerik:RadGridView>

XAML-Code (DataForm):

01.<Grid.Resources
02.                <DataTemplate x:Key="WriteTemplate">
03.                    <Grid>
04.                        <Grid.ColumnDefinitions>
05.                            <ColumnDefinition Width="150"></ColumnDefinition>
06.                            <ColumnDefinition Width="*"></ColumnDefinition>
07.                        </Grid.ColumnDefinitions>
08.                        <Grid.RowDefinitions>
09.                            <RowDefinition></RowDefinition>
10.                            <RowDefinition></RowDefinition>
11.                            <RowDefinition></RowDefinition>
12.                            <RowDefinition></RowDefinition>
13.                            <RowDefinition></RowDefinition>
14.                        </Grid.RowDefinitions>
15.                        <Label Grid.Row="0" Grid.Column ="0" Margin="0,5,0,0">Dokumententitel:</Label>
16.                        <Label Grid.Row="1" Grid.Column ="0" Margin="0,5,0,0">Dokumentengruppe:</Label>
17.                        <Label Grid.Row="2" Grid.Column ="0" Margin="0,5,0,0">Dokumententyp:</Label>
18.                        <Label Grid.Row="3" Grid.Column ="0" Margin="0,5,0,0">Gesperrt:</Label>
19.                        <Label Grid.Row="4" Grid.Column ="0" Margin="0,5,0,0">Systemeintrag:</Label>
20.                        <telerik:DataFormDataField Grid.Row="0" Grid.Column ="1" DataMemberBinding="{Binding Name , Mode=TwoWay}" HorizontalAlignment="Stretch" LabelPosition="Above" Margin="0,5,0,0"/>
21.                        <telerik:DataFormComboBoxField Grid.Row="1" Grid.Column="1" HorizontalAlignment="Stretch" LabelPosition="Above" Margin="0,5,0,0"
22.                                                       ItemsSource="{Binding ItemsSource, ElementName=cbxDocumentTitleGroup, Mode=TwoWay}"
23.                                                       DataMemberBinding="{Binding Group.Id}"
24.                                                       DisplayMemberPath="Name"
25.                                                       SelectedValuePath="Id"
26.                                                       SelectedIndex="{Binding Group}"/>
27.                        <telerik:DataFormComboBoxField Grid.Row="2" Grid.Column="1" HorizontalAlignment="Stretch" LabelPosition="Above" Margin="0,5,0,0"
28.                                                       ItemsSource="{Binding ItemsSource, ElementName=cbxDocumentTitleType}"
29.                                                       DataMemberBinding="{Binding Type.Id}"
30.                                                       DisplayMemberPath="Name"
31.                                                       SelectedValuePath="Id"
32.                                                       SelectedIndex="{Binding Type}"/>
33.                        <telerik:DataFormCheckBoxField Grid.Row="3" Grid.Column ="1" DataMemberBinding="{Binding Locked , Mode=TwoWay}" HorizontalAlignment="Stretch" LabelPosition="Above" Margin="0,5,0,0"/>
34.                        <telerik:DataFormCheckBoxField Grid.Row="4" Grid.Column ="1" IsReadOnly="True" DataMemberBinding="{Binding System , Mode=TwoWay}" HorizontalAlignment="Stretch" LabelPosition="Above" Margin="0,5,0,0"/>
35.                    </Grid>
36.                </DataTemplate>
37.            </Grid.Resources>   
38. 
39.        <telerik:RadDataForm x:Name="EntryDetails" Grid.Row="2" Header="Dokumententitel"
40.                             CommandButtonsVisibility="Cancel, Commit" AutoGenerateFields="False" AutoCommit="False"
41.                             EditEnding="EntryDetails_EditEnding"  ValidatingItem="EntryDetails_ValidatingItem" EditEnded="EntryDetails_EditEnded"
42.                             ReadOnlyTemplate="{StaticResource ReadTemplate}"
43.                             EditTemplate="{StaticResource WriteTemplate}"
44.                             NewItemTemplate="{StaticResource WriteTemplate}"
45.                             ItemsSource="{Binding DataView, ElementName=DocumentTitlesDataSource}"/>  

C# Code:

01.public DocimpDocumentTitles(VIMANTO.Environment My)
02.        {
03.            InitializeComponent();
04.            my = My;
05.            db.Database.Connection.ConnectionString = my.CurrentConnection.GetSqlConntectionString();
06.            DocumentTitlesDataSource.DbContext = db;
07. 
08.            ObservableCollection<CatalogEntry> documentTitleGroups = new ObservableCollection<CatalogEntry>();
09.            ObservableCollection<CatalogEntry> documentTitleTypes = new ObservableCollection<CatalogEntry>();
10. 
11.            documentTitleGroups = Database.Views.CatalogViews.GetCatalogEntries(my.CurrentConnection, VIMANTO.Database.Views.CatalogViews.GetCatalog(my.CurrentConnection, "Dokumentengruppen").Id, true);
12.            cbxDocumentTitleGroup.ItemsSource = documentTitleGroups;
13. 
14.            documentTitleTypes = Database.Views.CatalogViews.GetCatalogEntries(my.CurrentConnection, VIMANTO.Database.Views.CatalogViews.GetCatalog(my.CurrentConnection, "Dokumententypen").Id, true);
15.            cbxDocumentTitleType.ItemsSource = documentTitleTypes;
16.        }  

 

 

 

 

 

 

 

 

 

 

Dilyan Traykov
Telerik team
 answered on 20 Sep 2016
1 answer
190 views

Hi,

I have a Wizard that uses the Back, Next, Finish, and Cancel buttons.

I was wondering if there is a way to have the Cancel button displayed on the bottom-left side of the button area? I am trying to get it to a similar location as the Help button.Currently, all 4 buttons are displayed on the bottom-right side of the button area, and I was hoping we could modify that.

If this is not possible, is there a way to change the order they appear in? As it stands, the buttons are always displayed in Back-Next-Finish-Cancel order, and Cancel-Back-Next-Finish order would be an acceptable compromise.

Take care,
-Thanos

Yoan
Telerik team
 answered on 20 Sep 2016
3 answers
138 views

Hello,

I have a Wizard that has 3 pages. Each page has a ListBox with items for the user to select.

My problem is that when the user makes the selections on the first page's Listbox then clicks "Next" to go to page 2, the first page's ListBox's SelectedItems collection becomes empty (instead of being populated with the items the user selected on the first page). However, when I go back to page 1, the ListBox's SelectedItems collection now contains what the user selected.

Does the Wizard do something behind the scenes to the contents of the pages? (Perhaps to conserve memory, etc.) If so, is there a way to disable this?

Thanks,
-Thanos

Yoan
Telerik team
 answered on 20 Sep 2016
5 answers
194 views

Hi,

I want to show my user control Editor  as complete row in the property grid without display name column in the row. In the attached image I have shown what I am getting now. I want to show only Color editor once we open color group with out showing again color as display name in the row.How to achieve it?? 

 

Stefan
Telerik team
 answered on 20 Sep 2016
3 answers
200 views

Hi,

   I have WPF Form which has to be invoked as editor from RadPropertyGrid and here another difficult thing is I have to send input to the constructor of this form.In winform using UITypeEditor inherited class we have created another editor and used it.But in RadPropertyGrid how to achieve this??

 

Regards,

Nagasree.

Dilyan Traykov
Telerik team
 answered on 20 Sep 2016
1 answer
266 views

Hi, 

   I have to customize the modal dialog shown when propertygrid editor attribute editor style value is 'Modal'. I don't want to show user Minimize and Maximize buttons of the window,I don't want to allow user to resize the dialog.I want to show form name  and Icon for the form of my own.

How to achieve this??

Regards,

Nagasree.

Dilyan Traykov
Telerik team
 answered on 20 Sep 2016
1 answer
171 views

I use ColumnGroupDescriptor to group the GrieView 

<telerik:RadGridView.GroupDescriptors>
                <telerik:ColumnGroupDescriptor x:Name="columnGroupDescriptor" Column="{Binding Columns[\ContactTitleWithConverter\], ElementName=ESColumnGrid}"  SortDirection="Descending"/>
</telerik:RadGridView.GroupDescriptors>

the group sort  is according to the binding field  Ascending or Descending  

but my group is constant  for example   a,b,c  

Is any way to manual  sort the group for example as b c a

Stefan
Telerik team
 answered on 20 Sep 2016
15 answers
511 views
In my project some properties of my item could not be set in usual way. these are complicated types which have to set in a customized popup window. this behavior simply could be done by UI Type Editors in .net but it seems the radpropertygrid does not support the EditorAttribute's Component Model. This is exactly what I'm looking for but I couldn't find any similar approach for wpf and rad controls after hours of searching. I appreciate it if someone give me a hint.

Thanks in Advance
Dilyan Traykov
Telerik team
 answered on 20 Sep 2016
1 answer
202 views

I've got a series of DataFormDataFields, and I want the text within one of the boxes (if generated) to call a function if it's clicked once. When I attempt to style the text, I lose the textbox itself. All I want is for the DataMemberBinding to be blue and have an underline so it looks like a hyperlink almost. Here's what I'm trying:

 

<telerik:DataFormDataField  x:Name="Number"
                                                Label="Number"
                                                LabelPosition="Above"
                                                Foreground="{DynamicResource StandardForeground}"
                                                Grid.Row="1"
                                                Margin="0"
                                                IsReadOnly="True"
                                                Mode="ReadOnly"
                                                Padding="2"
                                                DataMemberBinding="{Binding DataContext.Number, Mode=OneWay, RelativeSource={RelativeSource AncestorType=UserControl}, UpdateSourceTrigger=PropertyChanged}" Template="{DynamicResource HyperlinkNumber}"/>
 
 
            <ControlTemplate x:Key="HyperlinkNumber" TargetType="{x:Type telerik:DataFormDataField}">
   <Grid x:Name="PART_DataFormDataFieldGrid" Margin="2">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition/>
   <RowDefinition/>
                </Grid.RowDefinitions>
 
                <ContentControl x:Name="PART_Label" Grid.Row="0" Grid.Column="0" Content="Number" Foreground="{DynamicResource StandardForeground}"  Margin="5,0,0,2"/>
<ContentControl x:Name="PART_FieldsContentPresenter" Grid.Row="1" Grid.Column="0" Content="{Binding DataContext.Number, Mode=OneWay, RelativeSource={RelativeSource AncestorType=UserControl}, UpdateSourceTrigger=PropertyChanged}" Margin="2" Foreground="Blue"/>
    </Grid>
            </ControlTemplate>

 

Once I hit this point, the textbox looking element disappears so I haven't even tried getting the underline or making the element clickable. Is there some additional content control that will make the box appear? Thanks.

Stefan
Telerik team
 answered on 20 Sep 2016
3 answers
211 views

When one or more rows are selected in a RadGridView, their cell backgrounds change to (by default) a pale orange color, with gradation I think.  But, when this happens, the backgrounds of those cells of the selected rows that are in GridViewCheckBoxColumns remain white.  I want to show the row selection color in the GridViewCheckBoxColumn cells, to make them consistent with the other cells in the selected rows.

I think the problem is that the embedded CheckBox completely fills the cell, obscuring the cell background proper.  If that is the case, then perhaps a solution would be to set the CheckBox's own background to transparent, so that the underlying cell color changes (when the row is selected and deselected) would be visible. 

If all that is true, then what I specifically want to know is how to set the background color of the embedded CheckBox in every cell of every GridViewCheckBoxColumn in the grid to transparent when the grid is shown.

Stefan Nenchev
Telerik team
 answered on 20 Sep 2016
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
PasswordBox
SplashScreen
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?