Telerik Forums
UI for WPF Forum
0 answers
121 views

Hello, 

Can anyone please explain to me how to resize the row height whenever the RadGridView height is changed at runtime?

Thanks in advance.

awt
Top achievements
Rank 1
 asked on 13 Jul 2016
2 answers
489 views
How would I go about adding a RadContextMenu to a RadGridView programmatically? I am building the RadGridView completely in code at runtime, and don't have a predefined XAML component.

The RadGridView only seems to have a ContextMenu that can be set, but I can't hook a RadContextMenu to the ContextMenu property.

Any advice? I need this so I can have the row that is right-clicked selected, and I can look at the current cell so that I can have specific menu items added to the context menu.
Oscar
Top achievements
Rank 1
 answered on 12 Jul 2016
4 answers
126 views

Hello,

Looks like this issue is with the theme. We are using two themes in our application. In ExpressionDark theme, the scroll bar is working fine in Gridview.

If we use Visual studio light theme, scroll bar is not moving when we click on the area below scroll bar. We are able to scroll the data by dragging the scroll bar or clicking on top and bottom icons. 

Can anyone help with the issue.

 

TIA

crazy05
Top achievements
Rank 1
 answered on 12 Jul 2016
11 answers
479 views
I am using the below code to create an excel file:

Workbook workbook = new Workbook();
workbook.Worksheets.Add();
string fileName = "SampleFile.xlsx";
  
IWorkbookFormatProvider formatProvider = new XlsxFormatProvider();
  
using (FileStream output = new FileStream(fileName, FileMode.Create))
{
    formatProvider.Export(workbook, output); //System.OutOfMemoryException thrown here
}

Where the variable workbook contains a lot of data (about 115000 rows worth).  My problem is that the host computer doesn't have enough memory to do the excel export, so an outofmemoryexception is thrown at formatProvider.export().

Is there a way to split up Excel file export into smaller parts so that I don't run out of memory?  I need all of the data to be in the same excel file.

Siward

Nikolay Demirev
Telerik team
 answered on 12 Jul 2016
1 answer
744 views

Hi,

I want to change the default header text. For example I have following properties

  • Id
  • Title
  • Description

If user will group it by Id, then I want to show group header text like [Id]:[Title]. How can I do this?

 

Thanks, 

Daler

 

 

Dilyan Traykov
Telerik team
 answered on 12 Jul 2016
3 answers
375 views

Hi,

I'm new to WPF and Telerik controls.

I'm using trial version of Telerik controls.

I'm developing a WPF desktop application. For one of its UI, it requires some complex requirement to have a Hierarchical Grid View, with two dependent ComboBox columns, UpDownNumeric button in Text Column and AutoFilter/Sorting on Columns in child and parent grids.

I'm able to achieve the above by using telerik controls, but the styles of all the controls are not matching my current WPF UI Desktop application. The telerik controls shows up yellow and orange colors on mouse over and selection in all controls.

I would like to override this default behaviour with the coloring schemes as per my application.

Please let me know where to make the change so as to affect all the controls to override the default color styles.

Below is the code snippet of UI:

<DockPanel>
        <DockPanel.Resources>
            <DataTemplate x:Key="InnerTemplate" >
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <telerik:RadCollectionNavigator x:Name="collectionNavigator" CommandButtonsVisibility="All" Grid.Column="0" Grid.Row="0"
                                                    Visibility="Visible" Source="{Binding }" ScrollViewer.CanContentScroll="True" 
                                                    SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical"/>
                    <telerik:RadGridView x:Name="grid" ItemsSource="{Binding ElementName=collectionNavigator, Path=CollectionView}" Grid.Column="0" Grid.Row="1"
                                         Height="600" AutoGenerateColumns="False" CanUserInsertRows="True"
                                         IsReadOnly="False"  SelectionMode="Single"
                                         AlternationCount="2"
                                         AlternateRowBackground="{x:Static SystemColors.ControlLightBrush}" 
                                         HorizontalGridLinesBrush="{x:Static SystemColors.ActiveBorderBrush}" 
                                         VerticalGridLinesBrush="{x:Static SystemColors.ActiveBorderBrush}"
                                         BorderBrush="{x:Static SystemColors.ActiveBorderBrush}"
                                         BorderThickness="0"
                                         FontWeight="Normal"
                                         VerticalContentAlignment="Stretch"
                                         orizontalContentAlignment="Stretch"
                                         Padding="0" 
                                         SnapsToDevicePixels="True"
                                         ValidatesOnDataErrors="None">
                        <telerik:RadGridView.Columns>
                            <telerik:GridViewComboBoxColumn Header="Material" 
                                                            DataMemberBinding="{Binding MaterialId, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" 
                                                            ItemsSource="{Binding Materials}" 
                                                            SelectedValueMemberPath="MaterialId" 
                                                            DisplayMemberPath="MaterialDescription" 
                                                            EditTriggers="CellClick"  Width="200" >
                                <telerik:GridViewComboBoxColumn.EditorStyle  >
                                    <Style TargetType="telerik:RadComboBox">
                                        <Setter Property="OpenDropDownOnFocus" Value="True"/>
                                        <Setter Property="Background" Value="{x:Static SystemColors.ControlLightBrush}"/>
                                    </Style>
                                </telerik:GridViewComboBoxColumn.EditorStyle>
                            </telerik:GridViewComboBoxColumn>
                            <telerik:GridViewComboBoxColumn  Header="Attribute Type"  Width="200"
                                                             ItemsSourceBinding="{Binding DemoList,UpdateSourceTrigger=PropertyChanged}" 
                                                             DataMemberBinding="{ Binding MaterialAttributeTypeId}" 
                                                             DisplayMemberPath="Description" 
                                                             SelectedValueMemberPath="MaterialAttributeTypeId" 
                                                             EditTriggers="CellClick" >
                                <telerik:GridViewComboBoxColumn.EditorStyle>
                                    <Style TargetType="telerik:RadComboBox">
                                        <Setter Property="OpenDropDownOnFocus" Value="True"/>
                                        <Setter Property="Background" Value="{x:Static SystemColors.ControlLightBrush}"/>
                                    </Style>
                                </telerik:GridViewComboBoxColumn.EditorStyle>
                            </telerik:GridViewComboBoxColumn>
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding ColumnWidth}" Width="200"
                                                        Header="Column Width"  >
                                <telerik:GridViewDataColumn.CellEditTemplate>
                                    <DataTemplate>
                                        <telerik:RadNumericUpDown Value="{Binding ColumnWidth}" UpdateValueEvent="PropertyChanged"  />
                                    </DataTemplate>
                                </telerik:GridViewDataColumn.CellEditTemplate>
                            </telerik:GridViewDataColumn>

                            <telerik:GridViewCheckBoxColumn Header="Include ?" Width="200"
                                                            DataMemberBinding="{Binding IncludeInReport}" 
                                                            EditTriggers="CellClick"  />

                            <telerik:GridViewDataColumn DataMemberBinding="{Binding ReportSequenceTag,Mode=TwoWay}" Width="100"
                                                        Header="Report Sequence" >
                                <telerik:GridViewDataColumn.CellEditTemplate>
                                    <DataTemplate>
                                        <telerik:RadNumericUpDown Value="{Binding ReportSequenceTag}" UpdateValueEvent="PropertyChanged"  />
                                    </DataTemplate>
                                </telerik:GridViewDataColumn.CellEditTemplate>
                            </telerik:GridViewDataColumn>
                        </telerik:RadGridView.Columns>
                    </telerik:RadGridView>
                </Grid>
            </DataTemplate>
        </DockPanel.Resources>
        <telerik:RadGridView EnableRowVirtualization="True"  x:Name="HierarchicalGridView" DockPanel.Dock="Top"
                             AutoGenerateColumns="False"   HierarchyChildTemplate="{StaticResource InnerTemplate }" 
                             RowIndicatorVisibility="Collapsed" IsReadOnly="True" AlternationCount="2"
                             AlternateRowBackground="{x:Static SystemColors.ControlLightBrush}" 
                             HorizontalGridLinesBrush="{x:Static SystemColors.ActiveBorderBrush}" 
                             VerticalGridLinesBrush="{x:Static SystemColors.ActiveBorderBrush}"
                             BorderBrush="{x:Static SystemColors.ActiveBorderBrush}" 
                             ShowGroupPanel="False"
                             ColumnWidth="*" 
                             ValidatesOnDataErrors="None">
            <telerik:RadGridView.ChildTableDefinitions>
                <telerik:GridViewTableDefinition >
                </telerik:GridViewTableDefinition>
            </telerik:RadGridView.ChildTableDefinitions>
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="Report Name" DataMemberBinding="{Binding ReportName}">
                </telerik:GridViewDataColumn>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
    </DockPanel>

Dilyan Traykov
Telerik team
 answered on 12 Jul 2016
2 answers
643 views

Hi there,

I'm trying to get the multiselection of the RadGridView working. I have a class Building with a Property IsSelected. With the Selection_Changed event i set/unset the property of the item. Is it possible to bind to the Building.IsSelected, so each row gets selected, if its object.IsSelected is true?

I know about the solution with behaviors, but I'd like one without it.

A little sample here:

<telerik:RadGridView x:Name="BuildingListGrid" ItemsSource="{Binding BuildingList}" EnableRowVirtualization="True"
                                 SelectionUnit="FullRow" SelectionMode="Extended" SelectionChanged="MasterBuildingListGrid_OnSelectionChanged">     <telerik:RadGridView.Columns>
         <telerik:GridViewDataColumn DataMemberBinding="{Binding Building.Name}" Header="Column2" />

     </telerik:RadGridView.Columns>

</telerik:RadGridView>

 

public class Building : INotifyPropertyChanged
{
    public Building(Building building){}
    public bool IsSelected
    {
        get { return _isSelected; }
        set
        {
            if (value == _isSelected) return;
            _isSelected = value;
            OnPropertyChanged();
        }
    }

    public string Name { get; set; }

}

Stefan
Telerik team
 answered on 12 Jul 2016
5 answers
877 views
Hi guys,
As the title states, I'm trying to apply the OR logical operator between multiple column filters instead of the default AND operator that is applied when using the popup UI of the GridView.
I haven't found any simple way of doing this without attaching a DataFilter to the grid, and we do not like the UI of the DataFilter.
What I did come up with is handling the Sorted event and iterating over the columns to get their filters and add them to a compound filter like so:
Telerik.Windows.Data.CompositeFilterDescriptor mainFilter = new Telerik.Windows.Data.CompositeFilterDescriptor();
mainFilter.LogicalOperator = Telerik.Windows.Data.FilterCompositionLogicalOperator.Or;
this.dgTaskManager.FilterDescriptors.SuspendNotifications();
foreach (Telerik.Windows.Controls.GridViewColumn column in this.dgTaskManager.Columns)
{
    //Add all active column filters to the main filter
    if (column.ColumnFilterDescriptor.IsActive)
    {
        mainFilter.FilterDescriptors.Add(column.ColumnFilterDescriptor);
        this.filteredColumnList.Add(column);
    }
}
this.dgTaskManager.FilterDescriptors.Clear();
this.dgTaskManager.FilterDescriptors.Add(mainFilter);
this.dgTaskManager.FilterDescriptors.ResumeNotifications();

This works fine in terms of filtering correctly, but the funnel icon of the filtered columns is obviously unaffected since the FilterDescriptors collection of the grid no longer holds the filtered columns directly.
I tried manually setting each filtered column's FilterControl and setting its isActive property to true after ResumeNotifications(), but for some reasons it only highlights the last filtered column's funnel and only after opening and closing the filter control of the other filtered columns does it update their funnel's highlighting correctly. In addition it also doesn't seem to handle removing filters correctly (in terms of UI).
Does anyone have an idea how to achieve this? I can't believe that the need to apply the OR operator between columns hasn't arisen before me, am I missing something obvious?
Thanks
Orr
Dilyan Traykov
Telerik team
 answered on 12 Jul 2016
3 answers
658 views

We currently have an admin page that allows us to search for customers by email. My task is to also implement functionality that allows us to see all of a particular customer's orders for the past two weeks when we make that search. I modeled this data binding after the current data binding that exists, but it just causes a stack overflow exception, and I'm not sure what I'm doing wrong. Here's the markup:

 

<telerik:RadGrid ID="MailingsGrid" runat="server" AllowSorting="True" CellSpacing="0" GridLines="None" PageSize="50" OnItemDataBound="MailingsGrid_ItemDataBound">
    <MasterTableView Width="100%" NoMasterRecordsText="No users found" AutoGenerateColumns="false">
        <Columns>
            <telerik:GridBoundColumn DataField="Sub_Order_ID" HeaderText="Sub_Order_ID" UniqueName="Sub_Order_ID" ReadOnly="true" DataType="System.Int32" FilterControlAltText="Filter Sub_Order_ID column" SortExpression="Sub_Order_ID" />
                <telerik:GridBoundColumn DataField="Num_Pages" HeaderText="Num_Pages" UniqueName="Num_Pages" ReadOnly="true" DataType="System.Int32" FilterControlAltText="Filter Num_Pages column" SortExpression="Num_Pages" />
                    <telerik:GridTemplateColumn SortExpression="Address_1" HeaderText="Recipient" HeaderButtonType="TextButton" GroupByExpression="Address_1 Group by Address_1" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" ReadOnly="true" ItemStyle-Wrap="false">
                        <ItemTemplate><%#MailALetter.Common.FormatAddressTo(DataBinder.Eval(Container, "DataItem.Title"), DataBinder.Eval(Container, "DataItem.Name"), DataBinder.Eval(Container, "DataItem.JobTitle"), DataBinder.Eval(Container, "DataItem.Company"), DataBinder.Eval(Container, "DataItem.Address_1"), DataBinder.Eval(Container, "DataItem.Address_2"), DataBinder.Eval(Container, "DataItem.Address_3"),  DataBinder.Eval(Container, "DataItem.City"), DataBinder.Eval(Container, "DataItem.State"),  DataBinder.Eval(Container, "DataItem.Zip_Code_5"), DataBinder.Eval(Container, "DataItem.Zip_Code_4"),  DataBinder.Eval(Container, "DataItem.Country"))%>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridBoundColumn DataField="Date_Created" DataType="System.DateTime" FilterControlAltText="Filter Date_Created column" HeaderText="Date_Created" ReadOnly="True" SortExpression="Date_Created" UniqueName="Date_Created">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Date_Fullfilled" DataType="System.DateTime" FilterControlAltText="Filter Date_Fullfilled column" HeaderText="Date_Fullfilled" ReadOnly="True" SortExpression="Date_Fullfilled" UniqueName="Date_Fullfilled">
                    </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>

And here's the code behind:

protected void SearchButton_Click(object sender, EventArgs e)
    {       
        string EmailSearchTerm = SearchText.Text;
 
        UserResults = DBContext.Users.Where(x => SqlMethods.Like(x.Email, "%" + EmailSearchTerm + "%")).ToList();
        MembershipResults = DBContext.Memberships.Where(x => UserResults.Select(y => y.UserId).Contains(x.UserId)).ToList();
        SearchResults.DataSource = UserResults;
        // This line is causing the overflow exception
        MailingsGrid.DataSource = DBContext.LetterReports.Where(x => x.UserID.Equals(MembershipResults[0].UserId)).ToList();
        SearchResults.Rebind();
        MailingsGrid.DataBind();
    }

protected void MailingsGrid_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem item = (GridDataItem)e.Item;
 
            string SubOrderId = item.GetDataKeyValue("Sub_Order_ID").ToString();
            string DateCreated = item.GetDataKeyValue("Date_Created").ToString();
            string DateFullfilled = item.GetDataKeyValue("Date_Fulfilled").ToString();
            string Pages = item.GetDataKeyValue("Num_Pages").ToString();
        }
    }

Any help would be greatly appreciated, this is the latest of many iterations, and I'm kind of at a loss at this point.

Eyup
Telerik team
 answered on 12 Jul 2016
10 answers
490 views
By default RadWindow.Confirm defaults to OK button, how would I set the Cancel button to be the default?
Yana
Telerik team
 answered on 12 Jul 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
Slider
Expander
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
DesktopAlert
WatermarkTextBox
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
WebCam
CardView
DataBar
Licensing
FilePathPicker
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
HighlightTextBlock
Security
TouchManager
StepProgressBar
VirtualKeyboard
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?