Telerik Forums
UI for WPF Forum
1 answer
101 views

I have a RadGridView that I am trying to put a custom filter on. The field that I am trying to put the filter on is actually a List<string> field that I am formatting into a comma delimited list with a Converter object. If I have it set up that way, the RadGridView refuses to accept the CompositeFilterDescriptor object (using the Contains operator), but if I format the List<> to a comma delimited string before populating the GridView and forgo the Converter, it works fine.

 

Is there anything special you have to do when the field is a List<> or is it possible at all?

Yoan
Telerik team
 answered on 08 Feb 2016
3 answers
267 views

Hello,

I'm trying to figure out how to relate GroupDescriptors that I add to my Grid with the Groups that get created from them.  I essentially want to say "Group my Grid by column X (using a ColumnGroupDescriptor), and have that group be expanded by default."  I don't want *all* groups to be expanded by default, though, just specific ones.

I see that there is an ExpandGroup() method exposed off of GridView that can expand individual groups for me, but I don't see how the actual groups in GridView.Items.Groups are related to the GroupDescriptors used to create them.

 Is there a good way for me to accomplish this?

 

Thanks,

Ryan

Stefan
Telerik team
 answered on 08 Feb 2016
1 answer
111 views

It happens if you add the contextual group in code, and it is set as active.

The size of the Tab inside the group should also be larger then the size of the header. The result is at appeared in the image.

 

Here is the code:

Main window xaml:

<telerik:RadRibbonWindow x:Class="ContextualTab_Bug.MainWindow"
        Title="MainWindow" Height="350" Width="525" WindowState="Maximized">
     
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition />
        </Grid.RowDefinitions>
 
        <telerik:RadRibbonView telerik:StyleManager.Theme="Windows7" ApplicationButtonContent="Home" x:Name="ribbon">
            <telerik:RadRibbonTab Foreground="Black" Header="Edit" telerik:KeyTipService.AccessText="E">
            </telerik:RadRibbonTab>
 
            <telerik:RadRibbonTab Header="Controller" Foreground="Black" telerik:KeyTipService.AccessText="P" IsSelected="True">
            </telerik:RadRibbonTab>
 
            <telerik:RadRibbonTab Header="Tools" ToolTip="Tools" telerik:KeyTipService.AccessText="T">
            </telerik:RadRibbonTab>
 
            <telerik:RadRibbonTab Header="Help" telerik:KeyTipService.AccessText="S">
            </telerik:RadRibbonTab>
        </telerik:RadRibbonView>
         
        <Button HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="1" Click="Button_Click">Add Contextual Tabs</Button>
    </Grid>
</telerik:RadRibbonWindow>

 

 

 code behind that demonstrates the problem:

   public partial class MainWindow : RadRibbonWindow
    {
        bool tabWasAdded = false;
        public MainWindow()
        {
            InitializeComponent();
        }
 
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (!tabWasAdded)
            {
                RadRibbonContextualGroup telerikContextualTab = new RadRibbonContextualGroup()
                {
                    Name = "ct",
                };
 
                telerikContextualTab.Header = "Alarm";
                telerikContextualTab.IsActive = true;
                telerikContextualTab.Color = Brushes.Red;
 
                RadRibbonTab tab = new RadRibbonTab();
                tab.Header = "Alarms";
                tab.ContextualGroupName = "ct";
 
                ribbon.ContextualGroups.Add(telerikContextualTab);
 
                ribbon.Items.Insert(ribbon.Items.Count - 1, tab);
                tabWasAdded = true;
            }
            else
            {
                ribbon.ContextualGroups[0].IsActive = !ribbon.ContextualGroups[0].IsActive;
            }
        }
    }
}

 

 

If you click the twice again, then the contextual tabs will become inactive and then active, and this time, it will appear correctly.

It will also be drawn with the correct size, if you just resize the window.

 

 

I have a workaround for this issue:

Add the group with IsActive=false, and then Set the IsActive=true with BeginInvoke with priority Render and higher...

Martin Ivanov
Telerik team
 answered on 08 Feb 2016
1 answer
171 views

Hi,

 

I would like to know if it's possible to remove the group button in the control?

 

Thank's

Alain

Stefan
Telerik team
 answered on 08 Feb 2016
1 answer
93 views

Good  Evening,
there is a manner to diplay Document Host Strip on the right. I've read the thread where you explain how to set it bottom.
If it isn't possible, which componont can I use alternatively?

 

Thank you

Yana
Telerik team
 answered on 08 Feb 2016
1 answer
185 views

Hi, I need a couple of text rendering features that I can't find in your docs, and precisely:

1. Character spacing (horizontally): a numeric parameter to modify the spacing between chars. This measure could be expressed in pixels, points, percentage or whatever, the effect is that the single letters on the same line will be shown with a different spacing in between.

2. Show text in uppercase: a boolean switch. If enabled the text is shown in uppercase. When switched off, text will show back in original case, as it was written by the user. For this reason, this parameter must not modify the underlying text, only render it as uppercase when activated.

Are these features already implemented (and I just couldn't find them) or are they missing?

 

Thanks in advance.

Boby
Telerik team
 answered on 08 Feb 2016
2 answers
108 views

Hi,

Do you have a function to simplify a feature based on Geometry Algorithm ? 

We need to reduce the number of points in polyline - line - polygon. 

Thank you

 

 

Julien
Top achievements
Rank 1
 answered on 05 Feb 2016
7 answers
504 views

I’m developing a service where I need to create a chart using only code behind. The chart will then be exported to a bitmap and inserted into a RadDocument.

My code is:

Grid grid = new Grid();
grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });
grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
 
RadCartesianChart chart = new RadCartesianChart();
chart.Grid = new CartesianChartGrid
             {
                 MajorLinesVisibility = GridLineVisibility.Y,
                 StripLinesVisibility = GridLineVisibility.Y
             };
 
chart.HorizontalAxis = new CategoricalAxis { PlotMode = AxisPlotMode.BetweenTicks };
chart.VerticalAxis = new LinearAxis { Minimum = 0, MajorTickLength = 5, Title = "Y axis title" };
 
// create series
for (int i = 0; i < series.Count; i++)
{
    LineSeries lineSeries = new LineSeries
                            {
                                Stroke = new SolidColorBrush(series[i].Color),
                                LegendSettings = new SeriesLegendSettings { Title = series[i].Title }
                            };
 
    foreach (var value in series[i].Values)
    {
        lineSeries.DataPoints.Add(new CategoricalDataPoint { Category = value.X, Value = value.Y });
    }
 
    chart.Series.Add(lineSeries);
}
 
RadLegend legend = new RadLegend
                   {
                       HorizontalAlignment = HorizontalAlignment.Center,
                       VerticalAlignment = VerticalAlignment.Bottom,
                       Items = chart.LegendItems
                   };
 
string panelTemplate = @"<ItemsPanelTemplate xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"">" +
                       @"<StackPanel Orientation=""Horizontal""/>" +
                       @"</ItemsPanelTemplate>";
legend.ItemsPanel = (ItemsPanelTemplate)XamlReader.Parse(panelTemplate);
 
chart.SetValue(Grid.RowProperty, 0);
grid.Children.Add(chart);
 
legend.SetValue(Grid.RowProperty, 1);
grid.Children.Add(legend);
 
Size chartSize = new Size(width, height);
grid.Measure(chartSize);
grid.Arrange(new Rect(new Point(0, 0), chartSize));
 
grid.UpdateLayout();
 
RenderTargetBitmap bitmapRender = new RenderTargetBitmap(width, height, 96, 96, PixelFormats.Pbgra32);
bitmapRender.Render(grid);
 
var encoder = new PngBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(bitmapRender));
 
encoder.Save(stream);

If I set a breakpoint where the RadLegend is created, I can see that the series I’ve created have been added to chart.Series but chart.LegendItems is empty.

If I continue and export the chart to a bitmap I get an empty image.

All the code seems to be alright, what am I doing wrong?


 
 
Cleanwatts
Top achievements
Rank 1
 answered on 05 Feb 2016
2 answers
589 views

I'm trying to create a custom filter for a RadGridView, but no matter what I do I get the following error.

 

The value "(CategoryList Contains Allergies)" is not of type "Telerik.Windows.Data.IFilterDescriptor" and cannot be used in this generic collection.
Parameter name: value

 

The column that the filter is on contains a List<string> of possibly multiple category names in each row and the filter contains a distinct list of the categories.

 

001.public partial class CategoryFilter : UserControl, IFilteringControl
002.{
003.    private GridViewBoundColumnBase _column;
004. 
005.    public delegate void BeginCategoryChangeEvent();
006.    public event BeginCategoryChangeEvent BeginCategoryChange;
007. 
008.    public delegate void CategoryChangeEvent();
009.    public event CategoryChangeEvent CategoryChange;
010.    private CompositeFilterDescriptor _compositeFilter;
011. 
012. 
013.    public class CategoryItem
014.    {
015.        public string CategoryName { get; set; }
016.        public bool IsChecked { get; set; }
017.    }
018. 
019.    private List<CategoryItem> MainCategoryList;
020. 
021.    /// <summary>
022.    /// Gets or sets a value indicating whether the filtering is active.
023.    /// </summary>
024.    public bool IsActive
025.    {
026.        get { return (bool)GetValue(IsActiveProperty); }
027.        set { SetValue(IsActiveProperty, value); }
028.    }
029. 
030.    /// <summary>
031.    /// Identifies the <see cref="IsActive"/> dependency property.
032.    /// </summary>
033.    public static readonly DependencyProperty IsActiveProperty =
034.        DependencyProperty.Register(
035.            "IsActive",
036.            typeof(bool),
037.            typeof(CategoryFilter),
038.            new System.Windows.PropertyMetadata(false));
039. 
040. 
041. 
042. 
043.    public bool this[string CategoryName]
044.    {
045.        get
046.        {
047.            CategoryItem item = MainCategoryList.FirstOrDefault(i => i.CategoryName == CategoryName);
048. 
049.            if (item == null)
050.                throw new Exception("Category Name not found");
051. 
052.            return (item.IsChecked);
053.        }
054.        set
055.        {
056.            CategoryItem item = MainCategoryList.FirstOrDefault(i => i.CategoryName == CategoryName);
057. 
058.            if (item == null)
059.                throw new Exception("Category Name not found");
060. 
061.            item.IsChecked = value;
062.        }
063.    }
064. 
065.    [TypeConverter(typeof(String))]
066.    public List<string> Categories
067.    {
068.        get
069.        {
070.            return MainCategoryList.Where(i => i.IsChecked).Select(i => i.CategoryName).ToList();
071.        }
072.        set
073.        {
074.            foreach (CategoryItem item in MainCategoryList)
075.            {
076.                item.IsChecked = value.Contains(item.CategoryName);
077.            }
078.        }
079.    }
080. 
081.    public System.Windows.Controls.ListBox CategoryList
082.    {
083.        get { return this.LstCategories; }
084.    }
085. 
086.    public CategoryFilter()
087.    {
088.        InitializeComponent();
089.    }
090. 
091.    public void Prepare(GridViewColumn column)
092.    {
093.        this._column = column as GridViewBoundColumnBase;
094.        if (this._column == null)
095.        {
096.            return;
097.        }
098. 
099.        List<string> catList = ((List<EducationChoices>)(column.DataControl.ItemsSource))
100.            .SelectMany(l => l.CategoryList)
101.            .Distinct()
102.            .Where(l => (l ?? "")
103.                .Trim() != "")
104.            .OrderBy(c => c)
105.            .ToList();
106. 
107.        MainCategoryList = catList
108.                .Select(i => new CategoryItem() {CategoryName = i, IsChecked = false})
109.                .ToList();
110. 
111.        LstCategories.ItemsSource = MainCategoryList;
112.    }
113. 
114.    private void ChangeFilter(object sender, RoutedEventArgs e) {
115.        BeginCategoryChange();
116. 
117.        if (_compositeFilter != null) {
118.            _column.DataControl.FilterDescriptors.Remove(_compositeFilter);
119.        }
120.        _compositeFilter = new CompositeFilterDescriptor { LogicalOperator = FilterCompositionLogicalOperator.Or };
121.        var dataMember = _column.DataMemberBinding.Path.Path;
122. 
123.        string Category = ((CheckBox)e.OriginalSource).Tag.ToString();
124. 
125.        foreach (var item in MainCategoryList) {
126.            if (item.IsChecked) {
127.                var filter = new FilterDescriptor(dataMember, FilterOperator.Contains, Category);
128.                _compositeFilter.FilterDescriptors.Add(filter);
129.            }
130.        }
131. 
132.        if ((((CheckBox)e.OriginalSource).IsChecked ?? false) &&
133.                    _compositeFilter.FilterDescriptors.All(f => ((FilterDescriptor)f).Value.ToString() != Category))
134.        {
135.            var filter = new FilterDescriptor(dataMember, FilterOperator.Contains, Category);
136.            _compositeFilter.FilterDescriptors.Add(filter);
137.        } else if (!(((CheckBox) e.OriginalSource).IsChecked ?? false) &&
138.                   _compositeFilter.FilterDescriptors.Any(f => ((FilterDescriptor) f).Value.ToString() == Category))
139.        {
140.            _compositeFilter.FilterDescriptors.Remove(
141.                _compositeFilter.FilterDescriptors.FirstOrDefault(
142.                    f => ((FilterDescriptor) f).Value.ToString() == Category));
143.        }
144.       
145. 
146.        if (!_column.DataControl.FilterDescriptors.Contains(_compositeFilter)) {
147.            _column.DataControl.FilterDescriptors.Add(_compositeFilter);
148.        }
149. 
150.        this.IsActive = true;
151. 
152.        CategoryChange();
153.    }
154.}

 

I found this thread and tried to figure out what it was doing, but it didn't help.

Dilyan Traykov
Telerik team
 answered on 05 Feb 2016
1 answer
88 views

I have a laptop with 1920 x 1080 resolution.  When placing a RadScheduleView into a Grid (with this the only object in this user control), if I maximize the Window, the ScheduleView will not maximize to the full extents of the screen.  However, if I press the Restore Down button on the screen to get the screen out of Maximize, and drag the screen to be as large as possible, the ScheduleView fills the entire screen.  I would like the ScheduleView to fill the entire screen when I press the maximize button.

Any thoughts on this behavior?

Thanks,

HH

Nasko
Telerik team
 answered on 05 Feb 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
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
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?