Hi,
I'm new in WPF and I would like to know is possible to display in a RadGridView the headers with their details?
I have two DataTable which the first keep the header values and the second Datatable keeps the details values from a database. I'm able to display the header values in the RadGridview but I couldn't find how to display their details for each header.
For Example:
The RadGridView shows the Sales Number, Sales date and total then when the user clicks in the Sales number row it displays the Sales details with all the products and their descriptions.
I would appreciate your help or any suggestions.
Regards,
Oscar
Hello Telerik,
In my char, i'm using Cartesian & Bar Series. For the BarSeries, I'm using a "Custom Rectangle". My code :
BarSeries seriePluvio =
new
BarSeries();
//set attributs...
//....
//-------------
//Create a template for for custom bar
DataTemplate dt1 =
new
DataTemplate { DataType =
typeof
(System.Windows.Shapes.Rectangle) };
FrameworkElementFactory dt1Factory =
new
FrameworkElementFactory { Type =
typeof
(System.Windows.Shapes.Rectangle) };
//Set color for the bar --> IS OK
dt1Factory.SetValue(System.Windows.Shapes.Rectangle.FillProperty,
new
SolidColorBrush(param.CouleurMesuresValides));
//Set the width of the bar --> IS OK
double
d =
new
double
();
d = (Convert.ToDouble(param.EpaisseurTraitMesuresValides));
dt1Factory.SetValue(System.Windows.Shapes.Rectangle.WidthProperty, d);
//Set the line style of the bar --> IS NOK
dt1Factory.SetValue(System.Windows.Shapes.Rectangle.StrokeDashArrayProperty,
new
DoubleCollection { 2, 2, 2, 2 });
//The end of the code...
dt1.VisualTree = dt1Factory;
seriePluvio.PointTemplates.Add(dt1);
//...............
So, my problem is that the LineStyle is not applied. I tried with differents values/parameters for the DoubleCollection but this is always the same result. No visual changement.
I'm using StrokeDashArrayProperty because this is the used property for the CartesianSeries.
Can you help me ?
Thank you very much !
Hi,
I have all my code working great except for this one thing. When I add an item to the bound collection of the gridview my rowdetails template displays and all is well except that the + does not toggle to a -. How do I change this via code? I tried doing it in the OnCollectionChanged event (for the Add action) by setting the IsExpanded flag, but when I try to do a GetRowForItem, it returns null. If I try to find the selected item via MyGrid.ChildrenOfType<GridViewRow>(), ALL the items are null.
Help!!!
Thanks ... Ed
I am evaluating radpdfviewer and seeing Telerik.Windows.Documents.Core.Shapes instances ( Line Segment,Path Segment) are not cleaned up when taking memory snapshot in profiling app which invokes garbage collector. I am wondering why?
I initialize pdfviewer to read file on demand and use while loop to cycle through pages
pdfViewer.GoToPage(page) in a loop
when rerach last page I make page=1 and cycle again
Thanks
Hello,
I am doing a RadGridView, with data from a LiteDB with MVVM to refuel. This works so far quite well. Now you want to use a buttonbar to edit the data.
<
Button
Grid.Column
=
"0"
Margin
=
"0,0,3,0"
Command
=
"telerik:RadGridViewCommands.Delete"
CommandTarget
=
"{Binding ElementName=GridShutdowns}"
>
<
Grid
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"10"
/>
<
ColumnDefinition
Width
=
"*"
/>
</
Grid.ColumnDefinitions
>
<
fa:FontAwesome
Icon
=
"Trash"
VerticalAlignment
=
"Center"
HorizontalAlignment
=
"Center"
/>
<
TextBlock
Grid.Column
=
"2"
VerticalAlignment
=
"Center"
HorizontalAlignment
=
"Center"
Text
=
"Delete"
/>
</
Grid
>
</
Button
>
<
Button
Grid.Column
=
"1"
Margin
=
"0,0,3,0"
Command
=
"telerik:RadGridViewCommands.BeginInsert"
CommandTarget
=
"{Binding ElementName=GridShutdowns}"
>
<
Grid
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"10"
/>
<
ColumnDefinition
Width
=
"*"
/>
</
Grid.ColumnDefinitions
>
<
fa:FontAwesome
Icon
=
"PlusCircle"
VerticalAlignment
=
"Center"
HorizontalAlignment
=
"Center"
/>
<
TextBlock
Grid.Column
=
"2"
VerticalAlignment
=
"Center"
HorizontalAlignment
=
"Center"
Text
=
"Insert"
/>
</
Grid
>
</
Button
>
<
Button
Grid.Column
=
"2"
Margin
=
"0,0,3,0"
Command
=
"telerik:RadGridViewCommands.CommitEdit"
CommandTarget
=
"{Binding ElementName=GridShutdowns}"
>
<
Grid
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"10"
/>
<
ColumnDefinition
Width
=
"*"
/>
</
Grid.ColumnDefinitions
>
<
fa:FontAwesome
Icon
=
"Save"
VerticalAlignment
=
"Center"
HorizontalAlignment
=
"Center"
/>
<
TextBlock
Grid.Column
=
"2"
VerticalAlignment
=
"Center"
HorizontalAlignment
=
"Center"
Text
=
"Save"
/>
</
Grid
>
</
Button
>
<
Button
Grid.Column
=
"3"
Margin
=
"0,0,3,0"
Command
=
"telerik:RadGridViewCommands.CancelRowEdit"
CommandTarget
=
"{Binding ElementName=GridShutdowns}"
>
<
Grid
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"10"
/>
<
ColumnDefinition
Width
=
"*"
/>
</
Grid.ColumnDefinitions
>
<
fa:FontAwesome
Icon
=
"Ban"
VerticalAlignment
=
"Center"
HorizontalAlignment
=
"Center"
/>
<
TextBlock
Grid.Column
=
"2"
VerticalAlignment
=
"Center"
HorizontalAlignment
=
"Center"
Text
=
"Cancel"
/>
</
Grid
>
</
Button
>
I use how to see the Comands: RadGridViewCommands.CancelRowEdit, etc. (ShutdownViewModel.cs)
/// <summary>
/// Constructor
/// </summary>
public
ShutdownViewModel()
{
try
{
MakeSampleData();
InitializeCommands();
}
catch
(Exception exc)
{
Log.Error(exc);
}
}
/// <summary>
/// See the Sample on http://www.telerik.com/wpf/mvvm-support
/// </summary>
private
void
InitializeCommands()
{
ICommand deleteCommand = RadGridViewCommands.Delete;
ICommand saveCommand = RadGridViewCommands.CommitEdit;
//todo: ???
}
private
void
MakeSampleData()
{
using
(var db =
new
LiteDatabase(FileAndPath.DataBaseFile))
{
var ShutdownSources = db.GetCollection<Shutdown>(
"Shutdowns"
);
IEnumerable<Shutdown> shutdownSources = ShutdownSources.FindAll().OrderBy(x => x.Weekday).ThenBy(x => x.ShutdownTime.TimeOfDay);
if
(shutdownSources !=
null
&& shutdownSources.Any())
{
_shutdowns =
new
ObservableCollection<Shutdown>(shutdownSources);
}
else
{
_shutdowns =
new
ObservableCollection<Shutdown>()
{
new
Shutdown() {ShutdownId = Guid.NewGuid(), Weekday = 0},
new
Shutdown() {ShutdownId = Guid.NewGuid(), Weekday = 1},
new
Shutdown() {ShutdownId = Guid.NewGuid(), Weekday = 2},
new
Shutdown() {ShutdownId = Guid.NewGuid(), Weekday = 3},
new
Shutdown() {ShutdownId = Guid.NewGuid(), Weekday = 4},
new
Shutdown() {ShutdownId = Guid.NewGuid(), Weekday = 5},
new
Shutdown() {ShutdownId = Guid.NewGuid(), Weekday = 6},
};
var col = db.GetCollection<Shutdown>(
"Shutdowns"
);
foreach
(Shutdown shutdown
in
_shutdowns)
{
col.Insert(shutdown);
IndexObject(col);
}
}
}
}
After InitializeCommands I ask myself the question where I process now actually "saveCommand" and how?
Is that correct?
/// <summary>
/// SelectedItem
/// </summary>
public
Shutdown SelectedShutdown
{
get
{
return
_selectedShutdown; }
set
{
if
(_selectedShutdown != value)
{
_selectedShutdown = value;
OnPropertyChanged(nameof(SelectedShutdown));
}
}
}
/// <summary>
/// See the Sample on http://www.telerik.com/wpf/mvvm-support
/// </summary>
private
void
InitializeCommands()
{
ICommand deleteCommand = RadGridViewCommands.Delete;
ICommand saveCommand = RadGridViewCommands.CommitEdit;
//todo: ???
saveCommand.Execute(SaveShutdown());
}
private
object
SaveShutdown()
{
try
{
if
(SelectedShutdown !=
null
)
{
using
(var db =
new
LiteDatabase(FileAndPath.DataBaseFile))
{
//todo: save/update Shutdown for DB
}
}
}
catch
(Exception exc)
{
Log.Error(exc);
}
return
null
;
}
How do I use the RadGridViewCommands to edit data in the DB?
Thanks for your help
I have two controls in a GridViewDataColumn (LinkButton and Texblock) and only one control is visible at a time.
<
Controls:GridViewDataColumn
DataMemberBinding
=
"{Binding Id, Mode=OneWay}"
Header
=
"{x:Static lr:TransactionHistoryRes.Id_Header_Text}"
UniqueName
=
"TransactionHistoryModelId"
Width
=
"130"
>
<
Controls:GridViewDataColumn.CellTemplate
>
<
DataTemplate
>
<
Grid
>
<
max:LinkButton
HorizontalAlignment
=
"Right"
Command
=
"{Binding DataContext.OpenDocumentCommand, RelativeSource={RelativeSource FindAncestor, AncestorType=Views:TransactionHistoryView}}"
CommandParameter
=
"{Binding Path=.}"
Content
=
"{Binding Path=Id}"
Visibility
=
"{Binding Path=CanCreateOrViewDocument, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}"
>
</
max:LinkButton
>
<
TextBlock
HorizontalAlignment
=
"Right"
Text
=
"{Binding Path=Id}"
ToolTip
=
"{Binding Path=Information}"
Visibility
=
"{Binding Path=CanCreateOrViewDocument, Converter={StaticResource ReverseBooleanToVisibilityCollapsedConverter}}"
/>
</
Grid
>
</
DataTemplate
>
</
Controls:GridViewDataColumn.CellTemplate
>
</
Controls:GridViewDataColumn
>
When the grid initially load, it works fine.
However, there's a wierd behavior that if you SORT the column, initially - the LinkButtons wont show even if it's visibility = true
When you try to sort the column again, the LinkButtons are shown "gradually". (see video link below)
https://youtu.be/GI5G-WaPy-k
When I tried to remove the <Texblock> and just retain the LinkButton, its not behaving like this so I think its something about putting two controls in the cell template. I tried separating the two controls by stackpanel but sill the same behaviour.
Thanks,
Karlo
hi
I wanna to use RadTileView with pdfviewer in each content that display employee salary slips
<
telerik:RadGridView
Name
=
"grvKanten"
AutoGenerateColumns
=
"False"
IsReadOnly
=
"True"
CanUserReorderColumns
=
"True"
FilteringMode
=
"FilterRow"
FilterOperatorsLoading
=
"grvKanten_FilterOperatorsLoading"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
Name
=
"colKantenname"
DataMemberBinding
=
"{Binding Kantenname}"
Header
=
"Kantenname"
MinWidth
=
"150"
/>
<
telerik:GridViewDataColumn
Name
=
"colKantenbreitenname"
DataMemberBinding
=
"{Binding Kantenbreitenname}"
Header
=
"Kantenbreiten-Name"
MinWidth
=
"150"
/>
<
telerik:GridViewDataColumn
Name
=
"colLagerplatz"
DataMemberBinding
=
"{Binding Lagerplatzname}"
Header
=
"Lagerplatz"
MinWidth
=
"150"
/>
<
telerik:GridViewDataColumn
Name
=
"colLaenge"
DataMemberBinding
=
"{Binding Laenge}"
Header
=
"Länge"
MinWidth
=
"100"
/>
<
telerik:GridViewDataColumn
Name
=
"colDekor"
DataMemberBinding
=
"{Binding Dekor}"
Header
=
"Dekor"
MinWidth
=
"100"
/>
<
telerik:GridViewDataColumn
Name
=
"colBreie"
DataMemberBinding
=
"{Binding Breite}"
Header
=
"Kantenbreite"
MinWidth
=
"100"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
Private Sub grvKanten_FilterOperatorsLoading(sender As System.Object, e As Telerik.Windows.Controls.GridView.FilterOperatorsLoadingEventArgs)
e.AvailableOperators.Remove(Telerik.Windows.Data.FilterOperator.EndsWith)
e.AvailableOperators.Remove(Telerik.Windows.Data.FilterOperator.IsContainedIn)
e.AvailableOperators.Remove(Telerik.Windows.Data.FilterOperator.IsEmpty)
e.AvailableOperators.Remove(Telerik.Windows.Data.FilterOperator.IsEqualTo)
e.AvailableOperators.Remove(Telerik.Windows.Data.FilterOperator.IsGreaterThanOrEqualTo)
e.AvailableOperators.Remove(Telerik.Windows.Data.FilterOperator.IsLessThanOrEqualTo)
e.AvailableOperators.Remove(Telerik.Windows.Data.FilterOperator.IsNotEmpty)
e.AvailableOperators.Remove(Telerik.Windows.Data.FilterOperator.IsNotEqualTo)
e.AvailableOperators.Remove(Telerik.Windows.Data.FilterOperator.IsNotNull)
e.AvailableOperators.Remove(Telerik.Windows.Data.FilterOperator.IsNull)
e.AvailableOperators.Remove(Telerik.Windows.Data.FilterOperator.StartsWith)
e.AvailableOperators.Remove(Telerik.Windows.Data.FilterOperator.IsLessThan)
e.AvailableOperators.Remove(Telerik.Windows.Data.FilterOperator.IsGreaterThan)
e.DefaultOperator1 = Telerik.Windows.Data.FilterOperator.Contains
End Sub
Hello!
I'm using a "RadGridView" in my application. The grid is in a border with HorizontalAlignment="Stretch". I'm having 8 columns with only 2 of them given fixed widths. Since I want my grid to fill the horizontal space I'm setting the columns width in form of "*" values (e.g. 50* or 100*). Every thing works fine if the amount of data bound is small up-till around 50-70 max. When I bind a collection with more data like around 100-200 the UI starts to distort. The columns do not resize to take the whole space (Se the attached image). I need help asap on this.
Regards
Tushar Gupta