Telerik Forums
UI for WPF Forum
0 answers
220 views

I have a GridViewDataColumn that binds to a complex model (Custom class with a few properties and a ToString method)

The GridViewDataColumn also has a CustomGridFilter which is able to filter the column and has it's own popup. 

But .. now the users also want to Order by this column - but nothing happens when clicking on the Column Header. 

What am i missing ?

<telerik:GridViewDataColumn Width="100"
		DataMemberBinding="{Binding YearRange}"
		Header="Ã…rgang">
	<telerik:GridViewDataColumn.FilteringControl>
		<local:CustomGridFilter Aargang="{Binding ElementName=root, Path=VintageYear, Mode=TwoWay}" />
	</telerik:GridViewDataColumn.FilteringControl>
</telerik:GridViewDataColumn>
public class YearRange : IEquatable<int>
{
    public int FromYear { get; set; }

    public int ToYear { get; set; }

    public int Year { get; set; }

    public override string ToString()
    {
        if (FromYear == ToYear)
            return FromYear.ToString();

        return FromYear + "-" + ToYear;
    }

  #region Equals, GetHashCode

  #region Comparison operators override
}

public partial class CustomGridFilter : UserControl, IFilteringControl, INotifyPropertyChanged
{
    private GridViewBoundColumnBase column;
    private CompositeFilterDescriptor compositeFilter;
    private FilterDescriptor rangeFilter;

    #region INotifyPropertyChanged

    public void OnPropertyChanged(string name) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));

    public event PropertyChangedEventHandler PropertyChanged;

    #endregion

    #region IsActive DependencyProperty 
    public bool IsActive
    {
        get { return (bool)GetValue(IsActiveProperty); }
        set { SetValue(IsActiveProperty, value); }
    }

    public static readonly DependencyProperty IsActiveProperty =
        DependencyProperty.Register(
            "IsActive",
            typeof(bool),
            typeof(CustomGridFilter),
            new PropertyMetadata(false));
    #endregion

    #region Aargang DependencyProperty 

    public int? Aargang
    {
        get { return (int?)GetValue(AargangProperty); }
        set { SetValue(AargangProperty, value); }
    }

    public static readonly DependencyProperty AargangProperty =
        DependencyProperty.Register(
            "Aargang",
            typeof(int?),
            typeof(CustomGridFilter),
            new PropertyMetadata(
                null,
                (sender, evt) => { ((CustomGridFilter)sender).OnPropertyChanged("Aargang"); }
            )
        );

    #endregion

    public CustomGridFilter()
    {
        InitializeComponent();

        DataContext = this;

        PropertyChanged += CustomGridFilter_PropertyChanged;
    }

    private void CustomGridFilter_PropertyChanged(object sender, PropertyChangedEventArgs e)
    {
        if (e.PropertyName == "Aargang" && Aargang>1900 && Aargang<2100)
        {
            OnFilter(null, null);
        }
    }

    public void Prepare(Telerik.Windows.Controls.GridViewColumn column)
    {
        this.column = column as GridViewBoundColumnBase;

        if (this.column == null)
        {
            return;
        }

        if (compositeFilter == null)
        {
            CreateFilters();
        }
    }

    private void CreateFilters()
    {
        string dataMember = column.DataMemberBinding.Path.Path;

        compositeFilter = new CompositeFilterDescriptor();

        rangeFilter = new FilterDescriptor(dataMember, FilterOperator.IsEqualTo, null);

        compositeFilter.FilterDescriptors.Add(rangeFilter);
    }

    private void OnFilter(object sender, RoutedEventArgs e)
    {
        rangeFilter.Value = new YearRange { Year = Aargang ?? 0 };

        if (!column.DataControl.FilterDescriptors.Contains(compositeFilter))
        {
            column.DataControl.FilterDescriptors.Add(compositeFilter);
        }

        IsActive = true;

        var popup = this.ParentOfType<System.Windows.Controls.Primitives.Popup>();
        if (popup != null)
        {
            popup.IsOpen = false;
        }
    }

    private void OnClear(object sender, RoutedEventArgs e)
    {
        if (column.DataControl.FilterDescriptors.Contains(compositeFilter))
        {
            column.DataControl.FilterDescriptors.Remove(compositeFilter);
        }

        Aargang = 0;

        IsActive = false;

        var popup = this.ParentOfType<System.Windows.Controls.Primitives.Popup>();
        if (popup != null)
        {
            popup.IsOpen = false;
        }
    }

}

 

 

 

Martin
Top achievements
Rank 2
Iron
Iron
Iron
 asked on 05 May 2022
0 answers
169 views
I am using RadGridView's ExportToXlsx. I have been able to provide some styling (background colors and cell borders) in the ElementExportingToDocument event.  But I don't see a way to increase the row height and column width.  Is there a way to do this?
Carol
Top achievements
Rank 1
 asked on 04 May 2022
1 answer
151 views

I have a property called FolderName which is bound in storage view.xaml. I set this value with folder dialog. However if I call that value from within storage view or another view.cs its always defaulted. How do I persist the values across the running app. In code base I had to hardcover value.

https://github.com/CrownParkComputing/MegaDownloaderFinal

Petar Mladenov
Telerik team
 answered on 03 May 2022
1 answer
164 views
Still working on my DAX custom language editor. Color tagging and Intelliprompts are working, have moved on to overloads. By default, the overloads seem to display below the cursor which conflicts with the intelliprompts (overlaps). Can I move the overloads to display above the cursor instead and how?
Stenly
Telerik team
 answered on 02 May 2022
0 answers
166 views

Hi
I need to represent a list of columns  whose number is multiplied for the cardinality of a list of other elements.
For istance I have a list of "Sources": [S1, S2], and for every sources I have a fixed number of values [V1, V2, V3].
The columns table wil be:
S1                   | S2

V1 | V2 |V3    | V1 | V2 V3

I achieved that with the following code:
 

		private void SetTableColumns(ObservableCollection<StatisticaTableViewPerClasse> elementi
			, IEnumerable<string> sorgentiNames
			, string columnClassHeader)
		{
			GridAnalisiStatisticaTable.Columns.Clear();
			GridAnalisiStatisticaTable.ColumnGroups.Clear();
			if (elementi.Count() > 0)
			{
				//var sorgenti = elementi.GroupBy(e => e.Sorgente.Id,
				//				e => e.Sorgente.Name,
				//				(id, name) => name).Select(s => s.FirstOrDefault());
				foreach (var sorgenteName in sorgentiNames)
				{
					var groupName = GROUPNAME + sorgenteName;
					var group = new GridViewColumnGroup()
					{
						Header = sorgenteName,
						Name = groupName,
						
					};
					GridAnalisiStatisticaTable.ColumnGroups.Add(group); 
					//GridAnalisiStatisticaTable.Columns.Add(new GridViewDataColumn()
					//{
					//	Header = Utility.LoadString(ResourcesKeys.SorgenteColumnHeader),
					//	DataMemberBinding = new Binding("Sorgente.Name"),
					//	ColumnGroupName = groupName
					//});
					GridAnalisiStatisticaTable.Columns.Add(new GridViewDataColumn()
					{
						Header = columnClassHeader,
						DataMemberBinding = new Binding("ClasseHeader"),
						ColumnGroupName = groupName
					});
					GridAnalisiStatisticaTable.Columns.Add(new GridViewDataColumn()
					{
						Header = Utility.LoadString(ResourcesKeys.DistribuzioneProbabilitàHeader),
						DataMemberBinding = new Binding($"Values[{sorgenteName}].DistribuzioneValue")
						{
							StringFormat = "N2"
						},
						ColumnGroupName = groupName
					});
					GridAnalisiStatisticaTable.Columns.Add(new GridViewDataColumn()
					{
						Header = Utility.LoadString(ResourcesKeys.ProbabilitàCumulativaHeader),
						DataMemberBinding = new Binding($"Values[{sorgenteName}].CumulativaValue")
						{
							StringFormat = "N2"
						},
						ColumnGroupName = groupName
					});
				}
			}
		}
Where the GridView is defined as:

<t:RadGridView x:Name="GridAnalisiStatisticaTable" Grid.Row="1"
					   RowIndicatorVisibility="Collapsed"
					   AutoGenerateColumns="False"
						GroupRenderMode="Flat"
					   ShowGroupPanel="False"
						IsPropertyChangedAggregationEnabled="False"
					   ItemsSource="{Binding Statistiche}"/>
And the listed class is:


public class StatisticaTableView
	{
		public StatisticaTableView(KeyValuePair<decimal, double> entry, StatisticType type)
		{
			switch (type)
			{
				case StatisticType.DistribuzioneProbabilità:
					DistribuzioneValue = entry.Value;
					break;
				case StatisticType.ProbabilitàCumulativa:
					CumulativaValue = entry.Value;
					break;
				case StatisticType.LivelliPercentili:
					break;
				case StatisticType.DistribuzioneTemporale:
					break;
				default:
					break;
			}
		}
		public double DistribuzioneValue { get; set; }
		public double CumulativaValue { get; set; }
	}
	public class StatisticaTableViewPerClasse
	{
		public StatisticaTableViewPerClasse(KeyValuePair<decimal, double> entry, decimal classRange, StatisticType type, string sorgenteName)
		{
			Classe = entry.Key;
			ClasseHeader = $"{entry.Key} - {entry.Key + classRange}";
			Values.Add(sorgenteName, new(entry, type));
		}
		public decimal Classe { get; set; }
		public string ClasseHeader { get; set; }
		public Dictionary<string, StatisticaTableView> Values { get; set; } = new();
	}

But the resulting grid (formally correct) has very poor performance, when I scroll the rows, though the rows number is only 30.

I think that the problem comes from the binding with index (DataMemberBinding = new Binding($"Values[{sorgenteName}].DistribuzioneValue")), is there a way to achieve the same result with better  performance?
Thank you
Luigi
Luigi
Top achievements
Rank 3
Bronze
Iron
Iron
 asked on 02 May 2022
1 answer
217 views

Hi,

I am using RadNavigationViewControl with RadDocking inside in the mainWindow, main view.

like this:

<RadNavigationView>

   <RadNavigationView.Content>

     <RadDocking>

               <RadDocking.DocumentHost>

                              <RadPaneGroup Name=mainPaneGroup/>

               </RadDocking.DocumentHost>

     </RadDocking>

   </RadNavigationView.Content>

</RadNavigationView>

 

When I open the new menu, new RadPane is Created inside RadPaneGroup, and I want it to be isFloatable and isDockable.

But the problem is that when I unload radpane, the radpane unloaded is not "Dockable" to any of control.

When I remove RadNavigationView and put RadDocking independently, RadDocking itself and contents inside work fine.

Is there a way to implement RadDocking inside RadNavigationView Content?

 

 

Petar Mladenov
Telerik team
 answered on 02 May 2022
1 answer
147 views

Hi Telerik Team,

I looked at the example below and tried the same,

but it came out like the attached picture

https://docs.telerik.com/devtools/wpf/controls/raddiagram/extensions/settingspane/settingspaneview_properties

I want know if it is possible to change the width of  SettingsPaneView.

regards,

Dooly
Top achievements
Rank 1
Iron
 answered on 28 Apr 2022
0 answers
801 views

The scroll bars are placed in the tables

PROBLEM

When you have a WPF RadGridView based on Table of many columns, consequently the Horizontal Scrollbar appear in Last row's as shown below. As the user scrolls to the bottom, it is look like the last row is not fully visible, its content has been cut.

Note : Theme Setting Mechanisms

QUESTION : How can show Horizontal scrollbar correctly like : 

CAUSE & SOLUTION plz?

Asem
Top achievements
Rank 1
 updated question on 27 Apr 2022
0 answers
235 views

Codebase  available here : https://github.com/CrownParkComputing/MegaDownloaderFinal

so using the FolderDialog example for wpf, The binding for the propertt FolderName does not update after selecting a new folder. The original assignment works fine?

Errors shown  :

FolderName property not found on object of type String.

IsSearchActive property not found on object of type OpenFolderDialogViewModel.

ItemTemplate and ItemTemplateSelector are ignored for items already of the ItemsControl's container type RadWatermarkTextBox

Please help with these issues I am stumped. 

 

Jonathan
Top achievements
Rank 1
Iron
 asked on 26 Apr 2022
1 answer
202 views

Is there a quicker way of selecting / deselecting groups of children items in RadTreeListView ??


if (e.AddedItems.Count > 0)
            {
                foreach (NodesModel i in e.AddedItems)
                {
                    if (i.Name != "WHDLoad")
                    {
                        if (i.Items.Count > 0)
                        {
                            foreach (NodesModel x in i.Items)
                            {
                                {
                                    //x.IsSelected = true;
                                    Nodes.SelectedItems.Add(x);
                                }
                            }
                        }
                    }
                }
            }

Jonathan
Top achievements
Rank 1
Iron
 answered on 26 Apr 2022
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
DataPager
PersistenceFramework
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
NavigationView (Hamburger Menu)
Wizard
ExpressionEditor
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
Callout
PasswordBox
SplashScreen
Localization
Rating
Accessibility
CollectionNavigator
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
InlineAIAssistant
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?