Telerik Forums
UI for WPF Forum
5 answers
105 views

Hi All,

I am using RadGridView with MVVM binding. I am pulling large amount of data i.e.5000 records from database so used BackgroundWorker for data processing.

In RunWorkerCompleted event  i am assigning data to ObservableCollection which is my grid's ItemsSource.

Everything works well except rowindicator, it's not visible if i bind data in worker completed event.

If i remove background worker and execute process on main thread then rowindicator displayed on grid.

 

Here is my sample code;

  public ObservableCollection<Assets> AssetDs { get; set; } = new ObservableCollection<Assets>();

   private voids search()
        {

          BackgroundWorker bw = new BackgroundWorker();

           bw.DoWork += (sender, e) =>
                {
                   e.Result = //DB call to fetch records 
                };

            bw.RunWorkerCompleted += (sender, e) =>
                {

                     List<Asset> result = (List<Asset>)e.Result;

                     result.ForEach(a => AssetDs.Add(a));

                 }

               bw.RunWorkerAsync();

          }

Any help would be appreciated,

Prashant

 

 

 

 

Dilyan Traykov
Telerik team
 answered on 01 Nov 2019
3 answers
777 views

Hi All,

What is the best approach to notify required combobox on button click? I have a form with 4 tabs and each tab has some mandatory fields.

If user clicks on button i want to validate all tabs and notify user with highlighting required controls. 

Looking for possible solutions for above workflow.

Any help would be appreciated,

Regards,

Prashant

 

 

 

 

Dilyan Traykov
Telerik team
 answered on 01 Nov 2019
1 answer
231 views

Hi guys,

 

I have a PivotGrid with a LocalDataSourceProvider.

The Itemsource of this LocalDataSourceProvider is a ObservableCollection.

I set these Descriptions:

            Telerik.Pivot.Core.PropertyGroupDescription pgdKWJahr = new Telerik.Pivot.Core.PropertyGroupDescription();
            pgdKWJahr.PropertyName = "KWJahr";
            pgdKWJahr.SortOrder = SortOrder.None;
            Telerik.Pivot.Core.PropertyGroupDescription pgdBearbeiter = new Telerik.Pivot.Core.PropertyGroupDescription();
            pgdBearbeiter.PropertyName = "Bearbeiter";
            PropertyAggregateDescription padAnzahl = new PropertyAggregateDescription();
            padAnzahl.PropertyName = "Anzahl";

            using (ldspAnzahlÜbergabeWerk.DeferRefresh())
            {
                ldspAnzahlÜbergabeWerk.RowGroupDescriptions.Add(pgdKWJahr);
                ldspAnzahlÜbergabeWerk.ColumnGroupDescriptions.Add(pgdBearbeiter);
                ldspAnzahlÜbergabeWerk.AggregateDescriptions.Add(padAnzahl);

            };

If the ObservableCollection now changes, I have to call a Refresh on the LocalDataProvider:

UcReklamationsAnzahlÜbergabeWerkVerlauf.ldspAnzahlÜbergabeWerk.Refresh();

 

This is not that great, but works if a value changes.The problem is, it not triggers anything if a new item should appear or an item is removed.

For better understanding:

My Collection is a list of how much things a user in each week completed. If someone now changes the weekrange, there should appear the new weeks in this range.

 

Is there any possibility to achieve this?

 

Greetings

Benedikt

Dinko | Tech Support Engineer
Telerik team
 answered on 31 Oct 2019
2 answers
613 views

Hi everyone

I need to give each item in a RadCombobox a very specific color..

My XAML is:

<telerik:RadComboBox x:Name="cmbToolTypeForLoad" ItemsSource="{Binding ToolTypeForCmb}" DisplayMemberPath="Description"  Margin="46,29,0,0"                          HorizontalAlignment="Left" VerticalAlignment="Top" Width="421"  Height="48"  >
                    <ComboBoxItem>
                        <Style TargetType="ComboBoxItem">
                            <Setter Property="Background" Value="{Binding Color}"/>
                        </Style>
                    </ComboBoxItem>
                </telerik:RadComboBox>

 

to populate my combobox I had to convert the integer color stored in SQL:

 

 public partial class ToolTypeForCmb
    {
        public int ToolTypeId { get; set; }
        public string Description { get; set; }
        public Brush Color { get; set; }
    }

 

       List<ToolType> toolTypes = toolTypeService.GetAll(MachineryCode);
       List<ToolTypeForCmb> toolTypeForCmb = new List<ToolTypeForCmb>();
       foreach (ToolType toolType in toolTypes)
       {
                ToolTypeForCmb ttfcmb = new ToolTypeForCmb();
                ttfcmb.Color = UtilityService.ConvertIntToColorBrush(toolType.Color);
                ttfcmb.Description = toolType.Description;
                ttfcmb.ToolTypeId = toolType.ToolTypeId;
                toolTypeForCmb.Add(ttfcmb);
        }

       cmbToolTypeForLoad.ItemsSource = toolTypeForCmb;

 

Unfortunately, it generates an error when I assign the item.

"The collection of items must be empty before you can use ItemsSource".

 

how can i solve?

thanks

 

Martin Ivanov
Telerik team
 answered on 31 Oct 2019
3 answers
327 views

Hi All,

I am using RadGridView in WPF application with MVVM light. In celltemplate i am able to bind relay command for button but i am getting null argument on click event.

Sample Code:

<UserControl

                      ..

                       DataContext="{Binding SearchControlVM, Source={StaticResource Locator}}"

</UserControl>

..

 <telerik:RadGridView

  ..
                        <telerik:GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <telerik:RadButton Content="View" Command="{Binding Path=DataContext.ViewCommand,
                                                    RelativeSource={RelativeSource FindAncestor,AncestorType=telerik:RadGridView}}"  />
                                ..

 </telerik:RadGridView>

How to pass argument to MVVMlight relay command. Any help would be appreciated.

 

Thanks,

Prashant

 

 

Vladimir Stoyanov
Telerik team
 answered on 30 Oct 2019
6 answers
330 views

Hello,

I have a hierarchical grid similar to this layout https://docs.telerik.com/devtools/wpf/controls/radgridview/getting-started/building-hierarchical-grid-view

I need to be able to navigate through the parent grid and all the child grids using only a keyboard. My expected behavior is as follows:

  • If all the rows are collapsed, navigating through the rows will proceed in a left to right, top to bottom pattern, including the expander button
  • If focus is on an expander, pressing space bar will activate the expander and expose/hide the child grid as appropriate to the state of the expander
  • If a row is expanded to expose a child grid, pressing tab on the last column of the row will shift focus to the first row, first column cell of the child grid
  • While focus is in the child grid, navigating through the rows will proceed in a left to right, top to bottom pattern.
  • When focus is on the last row, last column cell of a child grid, pressing tab will set focus on the first cell in the next parent row.

Right now I have the following problems

  • The expander cannot be focused consistently. If I explicitly set Focusable=True on the column it only gains focus when navigating backwards with shift tab.
  • The expander cannot be activated with the keyboard.
  • The child grid is not keyboard accessible at all. Even if I use the mouse to explicitly set focus in the child grid I cannot keyboard navigate.

Questions:

  1. Does the expander control support consistent keyboard focusability and activation?
  2. Does the child grid support keyboard navigate at all?
Dilyan Traykov
Telerik team
 answered on 29 Oct 2019
3 answers
276 views

Hi,

I would like to Export my Document to string. In my older Version 2019.1.116 the following code works fine:

In this case I can use Telerik.Windows.Documents.FormatProviders.Html.HTMLFormatProvider

HtmlFormatProvider provider = new HtmlFormatProvider() { ExportSettings = new HtmlExportSettings() };

string comment = provider.Export(radRichTextBox.Document);

After Update 2019.3.1023 it doesn't work anymore and I have to use Telerik.Windows.Documents.Flow.FormatProviders.Html.HtmlFormatProvider

 

Same with the exportsettings:

provider.ExportSettings.ExportFontStylesAsTags = true;
provider.ExportSettings.ExportHeadingsAsTags = true;
provider.ExportSettings.StyleRepositoryExportMode = StyleRepositoryExportMode.DontExportStyles;
provider.ExportSettings.ExportLocalOrStyleValueSource = true;
provider.ExportSettings.PropertiesToIgnore["span"].Add("font-family");
provider.ExportSettings.PropertiesToIgnore["p"].Add("margin-top");
provider.ExportSettings.PropertiesToIgnore["p"].Add("margin-bottom");

only the following settings work:

provider.ExportSettings.StylesExportMode = StylesExportMode.Inline;
provider.ExportSettings.DocumentExportLevel = DocumentExportLevel.Fragment;

 

What do I have to do to use the old methods again or achieve the same behaviour?

Regards,

Frank

Tanya
Telerik team
 answered on 29 Oct 2019
3 answers
206 views

Hello,

I have a case when the grid view must display plenty of data in a cell (in a log display). To avoid having very high rows, I have defined a template for the cell, as following:

<tk:GridViewDataColumn.CellTemplate>
  <DataTemplate>
    <ScrollViewer Background="Transparent"
              BorderThickness="0"
              Margin="0 1"
              MaxHeight="150">
  <TextBlock Text="{Binding Request}" />
    </ScrollViewer>
  </DataTemplate>
</tk:GridViewDataColumn.CellTemplate>

 

The problem is that, when I click on the cell, the row is not selected.

Dinko | Tech Support Engineer
Telerik team
 answered on 29 Oct 2019
3 answers
306 views

Hello,

I'm trying to use a read-only syntax editor inside a GridView. The goal is to display XML data in the grid view with syntax highlighting.
As the SyntaxEditor needs code to populate it, I defined a descendant class with Language and Text dependency properties

My first try was to use the following code for the cell:

<tk:GridViewDataColumn.CellTemplate>
  <DataTemplate>
    <os:osRadSyntaxEditor Background="Transparent"
                     IsReadOnly="True"
                     Language="Xml"
                     Text="{Binding Request}" />
  </DataTemplate>
</tk:GridViewDataColumn.CellTemplate>

 

The problems are the following:

  1. The display has line numbers and unnecessary scroll bars.
  2. When I try to zoom in with the mouse wheel, the height doesn't change.
  3. When I try to zoom out with the mouse wheel, the control seems to have an infinite height and the application freezes, using 100% of a CPU core.

 

To avoid problem 3, I've tried to set a maximum height for the control, using MaxHeight="150". Now, each grid view row has a height of 150, even if the content is smaller.

Dinko | Tech Support Engineer
Telerik team
 answered on 29 Oct 2019
1 answer
229 views

Hi everybody
I need to list a series of tools in a radcombobox where each color has a color associated with it.
The class of the tool is:
  public partial class ToolType
     {
         public int ToolTypeId {get; set; }
         public string Description {get; set; }
         public int Color {get; set; }
         public RecordState RecordState {get; set; }
         public string MachineryCode {get; set; }
         public int OwnerId {get; set; }

     }
where necessarily I had to transform the color to integer to be able to memorize it in SQL.

So I created a class to be able to use it in my RadCombobox to highlight on each item the color associated with my tool.

  public partial class ToolTypeForCmb
     {
         public int ToolTypeId {get; set; }
         public string Description {get; set; }
         public Brush Color {get; set; }
     }

So in my Xaml I created the RadCombobox:

 

<telerik:RadComboBox x:Name="cmbToolTypeForLoad" ItemsSource="{Binding ToolTypeForCmb}" DisplayMemberPath="Description"  Margin="46,29,0,0"      HorizontalAlignment="Left" VerticalAlignment="Top" Width="421"  Height="48"  >
                    <ComboBoxItem>
                        <Style TargetType="ComboBoxItem">
                            <Setter Property="Background" Value="{Binding Color}"/>
                        </Style>
                    </ComboBoxItem>
 </telerik:RadComboBox>

 

 

 

 

 List<ToolType> toolTypes = toolTypeService.GetAll(MachineryCode);
            List<ToolTypeForCmb> toolTypeForCmb = new List<ToolTypeForCmb>();
            foreach (ToolType toolType in toolTypes)
            {
                ToolTypeForCmb ttfcmb = new ToolTypeForCmb();
                ttfcmb.Color = UtilityService.ConvertIntToColorBrush(toolType.Color);
                ttfcmb.Description = toolType.Description;
                ttfcmb.ToolTypeId = toolType.ToolTypeId;
                toolTypeForCmb.Add(ttfcmb);
            }
            cmbToolTypeForLoad.ItemsSource = toolTypeForCmb;

 

 

 

 

Gianfranco
Top achievements
Rank 1
 answered on 29 Oct 2019
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
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
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?