Telerik Forums
UI for WPF Forum
1 answer
203 views

Hello! 

I have a question about the RadContextMenu. I created my class DataGridView so this class inherited from RadGridView. If I add contextMenu with    RadContextMenu.SetContextMenu(this, contextMenu) can't add new contextMenu. Look this:

public class DataGridView : RadGridView
{

   public DataGridView()
   {

          // create menu
            var contextMenu = new RadContextMenu();
            RadMenuItem item = new RadMenuItem();
            item.Header = "Hello";
            contextMenu.Items.Add(item);
            contextMenu.Opened += ContextMenu_Opened;
            //add something that we can use to get the data grid on context menu events
            contextMenu.ItemClick += ContextMenu_ItemClick;
            contextMenu.Opening += ContextMenu_Opening;
            // set menu Theme
            StyleManager.SetTheme(contextMenu, StyleManager.GetTheme(this));
            RadContextMenu.SetContextMenu(this, contextMenu);

   }
           

}

Nasko
Telerik team
 answered on 24 Nov 2015
3 answers
549 views
How to Save all rows from radgridview (wpf) to Sql database?
Dilyan Traykov
Telerik team
 answered on 24 Nov 2015
7 answers
401 views
Hello,

I want to avoid the overlap appointment for manage availability resources.
Is there a way to do that or i need to use custom  apointment/ availability ?

Gat

Roy
Top achievements
Rank 1
 answered on 24 Nov 2015
1 answer
546 views

Hi,

I'm trying to save RadGridView columns order by using Persistance manager:

                PersistenceManager manager = new PersistenceManager();
                manager.AllowCrossVersion = true;
                stream = manager.Save(radGridView);

 

And

Reading back:

                PersistenceManager manager = new PersistenceManager();
                stream.Position = 0L;
                manager.Load(radGridView, stream);

I change order using drag and drop  and then saving the radgridview.

Sometimes order is right, but many times order is something else that I save.

What is the problem? I sent your simple project that you can verified the problem.

 

Save button is saving grid on the stream.

Format button is return grid in original order.

Get button is loadin order in the stream.

 Here is to prosess:

1. Start to program.

2. Change column order

3. Press Save button.

4. Load original order.

5. Press Get Button.

Some times order is correct and some times is not.


 

 

Here is the c# colde:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Telerik.Windows.Controls;
using System.Collections.ObjectModel;
using Telerik.Windows.Controls.GridView;
using System.Data;
using System.Collections;
using Microsoft.Win32;
using Telerik.Windows.Documents.FormatProviders.Pdf;
using System.IO;
using System.Xml.Serialization;
using System.Globalization;
using Telerik.Windows.Persistence;
using Telerik.Windows.Zip;
using Telerik.Windows.Persistence.Services;
using Telerik.Windows.DragDrop;
using Telerik.Windows.DragDrop.Behaviors;
using System.IO.IsolatedStorage;

namespace GRID_TESTI
{
    /// <summary>
    /// Interaction logic for Page1.xaml
    /// </summary>
    public partial class Page1 : Page
    {
        AlarmDataCls ac = new AlarmDataCls();
        public Page1()
        {
            InitializeComponent();
            ServiceProvider.RegisterPersistenceProvider<ICustomPropertyProvider>(typeof(RadGridView), new GridViewCustomPropertyProvider());
            LoadColumns();
        }
        private Stream stream = null;
        public void LoadColumns()
        {

            AlarmDataCls ac = new AlarmDataCls();
            IList data = new ObservableCollection<AlarmDataCls>();

            radGridView.ItemsSource = null;
            radGridView.ItemsSource = data;


        }



        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            radGridView.Rebind();
            SaveToStream();

        }

        private void btnBring_Click(object sender, RoutedEventArgs e)
        {

            OpenFromStream();
        }

        private void SaveToStream()
        {
            try
            {
                PersistenceManager manager = new PersistenceManager();
                manager.AllowCrossVersion = true;
                stream = manager.Save(radGridView);
            }
            catch (Exception ex)
            {
            }
        }

        private void OpenFromStream()
        {
            try
            {
                PersistenceManager manager = new PersistenceManager();
                stream.Position = 0L;
                manager.Load(radGridView, stream);

            }
            catch (Exception ex)
            {

            }

        }
        private void btnAlusta_Click(object sender, RoutedEventArgs e)
        {
            LoadColumns();
        }

        public class AlarmDataCls
        {

            public AlarmDataCls()
            {

            }
            public string Eka
            {
                get;
                set;
            }
            public int Toka
            {
                get;
                set;
            }
            public int Kolmas
            {
                get;
                set;
            }
            public int Neljas
            {
                get;
                set;
            }
            public int Viides
            {
                get;
                set;
            }
            public int Kuudes
            {
                get;
                set;
            }
            public int Seiska
            {
                get;
                set;
            }
            public int Kasi
            {
                get;
                set;
            }
            public int Ysi
            {
                get;
                set;
            }
            public int Kymppi
            {
                get;
                set;
            }

            public int Yksitoista
            {
                get;
                set;
            }
            public int Kaksitoista
            {
                get;
                set;
            }
            public int Kolmetoista
            {
                get;
                set;
            }
            public int Neljatoista
            {
                get;
                set;
            }
        }


    }
}
    

And here is the Xaml:

 

<Page
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" x:Class="GRID_TESTI.Page1"
      mc:Ignorable="d"
      d:DesignHeight="300" d:DesignWidth="1300"
      Title="Page1">
    <Grid>
        <telerik:RadGridView  telerik:PersistenceManager.StorageId="radGridView"  
                        AutoGenerateColumns="true"                       
                        Margin="0,40,0,0"
                        Name="radGridView"
                        AllowDrop="True"
                        GroupRenderMode="Flat" Height="500">
        </telerik:RadGridView>
        <Button x:Name="btnSave" Content="Save" HorizontalAlignment="Left" Height="30" Margin="78,10,0,0" VerticalAlignment="Top" Width="120" Click="btnSave_Click"/>
        <Button x:Name="btnBring" Content="Get" HorizontalAlignment="Left" Height="30" Margin="220,10,0,0" VerticalAlignment="Top" Width="120" Click="btnBring_Click"/>
        <Button x:Name="btnAlusta" Content="Format" HorizontalAlignment="Left" Height="25" Margin="555,10,0,0" VerticalAlignment="Top" Width="100" Click="btnAlusta_Click"/>
    </Grid>


</Page>

 

 

Best Regards

Auvo K

 

 

Dinko | Tech Support Engineer
Telerik team
 answered on 24 Nov 2015
6 answers
231 views

I use group to show group data,  the group and item both can connec to other control , the design picture is as attach files "split.png"

there are two question

1. I set the template as follows

 <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="telerik:RadDiagramContainerShape">
                        <Border x:Name="ContainerBorder"
                                Width="30"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="15" />
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style> 

and set the item circle position as follows

 public override bool AddItem(object item)
        {
            var viewModel = item as TransformationNode;
            if (viewModel != null)
            {
                viewModel.Position = new Point(this.Position.X, this.InternalItems.Count * splitTransformationHeight);
                return base.AddItem(item);
            }

            return false;
        }

but the group show as attach files "SplitDiagramGroup.png"   the height is too big,what is the reason

2. I wish the  item circle can not drag alone, when drag the item circle,  the whole  group move too ,   how to realize?

 

than you 

rui
Top achievements
Rank 1
 answered on 24 Nov 2015
1 answer
46 views
Hi  please go through attached file .
Stefan
Telerik team
 answered on 24 Nov 2015
1 answer
110 views
Hi I have two  columns available in radgridview  Name and ID . Name column contain same value  but each  name associated with id i want  group by  on name on UI but  programmatically  it should group by using  ID . For example
Name      ID
N1          5
N1         7
N1         3
N1          2
When  use group by  on  Name result  should be
N1      2
N1      3
N1      5
N1      7
how to achieve it  please provide some hint 
Stefan
Telerik team
 answered on 24 Nov 2015
1 answer
397 views

Dear Team,

If the doc is open for the first time, a new doc window will open and if the same doc is open again, the existing window should be set active. Currently keep opening new windows instead show already opened window. How can i achieve this. please advise.

var openwindow = new PDFViewerWindow();
                                  openwindow.Show();
                                  openwindow.pdfViewer.DocumentSource =
                                      new PdfDocumentSource(new Uri(uri, UriKind.RelativeOrAbsolute));

Thank you.

Regards,

Prabakaran

Tanya
Telerik team
 answered on 24 Nov 2015
1 answer
136 views

I have an AutoCompleteBox defined like this:

<telerik:RadAutoCompleteBox Grid.Row="4" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,3,6,3"
     WatermarkContent="Interviewer's name..."
     x:Name="acb_Interviewer"
     TextSearchMode="Contains"
     AutoCompleteMode="Suggest"
     SelectionMode="Single"
     DropDownItemTemplate="{StaticResource RoomInterviewerSearchAutoComplete}"
     BorderBrush="#FF25A0DA" BorderThickness="1"
     SelectionChanged="Acb_Interviewer_OnSelectionChanged" />
 
 <DataTemplate x:Key="RoomInterviewerSearchAutoComplete">
    <StackPanel Orientation="Horizontal">
        <TextBlock Text="{Binding}" Style="{StaticResource AutoCompleteStyle}" />
    </StackPanel>
</DataTemplate>

 

The ItemSource is set to a List<string>.

I then try something like this but acb_Interviewer.SelectedItem remains null and only the watermark is visible in the control.

string interviewerName = dbContext.Users.First(u => u.Id == interview.PrimaryUserId).FullName;
acb_Interviewer.SelectedItem = interviewerName;

 

 What am I doing wrong?

Geri
Telerik team
 answered on 24 Nov 2015
0 answers
87 views

Hello!

I have a question about the RadContextMenu. I created my class DataGridView this class inherited from RadGridView. Look this:

 public class DataGridView : RadGridView
{

public DataGridView()
{

            // create menu
            var contextMenu = new RadContextMenu();
            RadMenuItem item = new RadMenuItem();
            item.Header = "Hello";
            contextMenu.Items.Add(item);
            contextMenu.Opened += ContextMenu_Opened;
            //add something that we can use to get the data grid on context menu events
            contextMenu.ItemClick += ContextMenu_ItemClick;
            contextMenu.Opening += ContextMenu_Opening;
            // set menu Theme
            StyleManager.SetTheme(contextMenu, StyleManager.GetTheme(this));
            RadContextMenu.SetContextMenu(this, contextMenu);

    }

}

Qutfullo
Top achievements
Rank 1
 asked on 24 Nov 2015
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
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
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
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?