Telerik Forums
UI for WPF Forum
4 answers
178 views
Is it possible to insert a "today" button in the schedule header, or to configure the date picker to show this option?
Claire
Top achievements
Rank 1
 answered on 11 Nov 2015
1 answer
189 views

We need to be able to enable or disable a DataPager associated with a GridView when the window loads (some users want it and other don't). I have tried setting the visibility to collapsed, setting IsEnabled to false and setting Source to null in the window constructor. None of these work. The pager isn't visible but the grid only shows the first page of data. The grid's ItemsSource is bound to an ObservableCollection and is populated in the Window_Loaded event. Here is the relevant xaml:

</telerik:RadGridView>
                       <telerik:RadDataPager x:Name="DpEvents" Grid.Row="2" Source="{Binding Items, ElementName=grdEvent}" PageSize="18"
                                             DisplayMode="All" AutoEllipsisMode="Both" NumericButtonCount="10" IsTotalItemCountFixed="True" />

Stefan
Telerik team
 answered on 11 Nov 2015
1 answer
148 views

Hi,

I'm migrating from RadMaskedTextBox to the new mask controls and encountered the following problem with MaskedDateTimeInput.

Up until now I used to set the "Text" property of the control, because my data structure holds the value as string with the correct format.

When I try setting the "Text" property of MaskedDateTimeInput via code to a certain date string, it doesn't affect the "Value" property.

When I click on the control it changes the text back to the current date.

 

I know I can use the value property but that requires me to convert my text value into DateTime and I don't want to do that if it can be done automatically via the control. 

Please advice

Peshito
Telerik team
 answered on 11 Nov 2015
1 answer
166 views

hello i'm trying to edit database from RadGridView, i'm using Scimore database and is connected to my GridView. I bind the itemsSource But if i change the data from Gridview, the database is not updated. why? how can i do that?

Here's my code :

XAML

<Grid>
        <StackPanel x:Name="LayoutRoot">
            <telerik:RadGridView x:Name="dataGrid1"
                                 AutoGenerateColumns="True"
                                 ColumnWidth="*"
                                 ShowGroupPanel ="False"
                                 CanUserReorderColumns ="False"
                                 ItemsSource="{Binding datatable.DefaultView}">
            </telerik:RadGridView>
        </StackPanel>
    </Grid>

CS

public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
 
            string dbInstanceName = "C:\\Users\\Admin\\Documents\\Visual Studio 2010\\Projects\\DisplayDB\\DisplayDB\\configdb";
            ScimoreEmbedded em = new ScimoreEmbedded();
            em.Open(dbInstanceName);
 
            try
            {
                using (ScimoreConnection cn = em.CreateConnection())
                {
                    cn.Open();
 
                    string Query = "select idx,tag,value from config.info";
                    ScimoreCommand createCommand = new ScimoreCommand(Query, cn);
                    createCommand.ExecuteNonQuery();
 
                    ScimoreDataAdapter dataAdp = new ScimoreDataAdapter(createCommand);
                    DataTable dataTable = new DataTable("info");
                    dataAdp.Fill(dataTable);
                    dataGrid1.ItemsSource = dataTable.DefaultView;
                    dataAdp.Update(dataTable);
                }
            }
            catch (Exception)
            {
            }
        }
    }

Maya
Telerik team
 answered on 11 Nov 2015
4 answers
127 views

Hi I am new to Telerik, so Im sorry if this is a stupid question.

 I need to translate some text to Swedish. Basicly everything in the new appointment window I need to translate. 

 I also want to completely remove the alldayevent and the edit recurrence features. 

 

Kalin
Telerik team
 answered on 11 Nov 2015
8 answers
1.1K+ views

Hello,

in the new features of the Q3 2015 version, it is that we can use IconSources to change the icons used for a RadRichTextBox UI.

Unfortunately, the documentation is very poor: http://docs.telerik.com/devtools/wpf/controls/radrichtextbox/how-to/switching-icons-at-runtime
1. Where do I need to put this XAML code?
2. Where do I specify the set of icons to use?

And most important:
3. How can I define my own icons for RadRichTextBox?

Thanks in advance

Tanya
Telerik team
 answered on 10 Nov 2015
2 answers
151 views

Hi,

I have a DataForm with AutoGenerateFields="True". In the AutoGeneratingField event handler I want to set a binding on the IsReadOnly property for some of the fields, so that when the FromProfile property is checked, those fields will be set as ReadOnly. The strange thing is that the binding only works if FromProfile is True when the AutoGeneratingField is fired. The DataField's ("Port", "Protocol" and "Interface") is set ReadOnly whenever the "FromProfile" DataField is checked. If FromProfile is False at the time the binding is set up, it doesn't work.

The AutoGeneratingField event handler looks like this:

01.if (e.DataField.Label.Equals("Port") || e.DataField.Label.Equals("Protocol") || e.DataField.Label.Equals("Interface"))
02.{
03.    var binding = new Binding("FromProfile")
04.    {
05.        Mode = BindingMode.OneWay,
06.        UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
07.    };
08.    e.DataField.SetBinding(DataFormDataField.IsReadOnlyProperty, binding);
09.}
 

Any idea why it doesn't work?

 

Regards,

Roar
Top achievements
Rank 1
 answered on 10 Nov 2015
1 answer
342 views

first forgive poor my english written

 

I Export to PNG before setting Zoom property is 5, 1 => 1, 1

but Export image is still 5, 1 Zoom setting

 

 in XAML Code

1.<!-- already Zoom property is 5,1 setting-->
2.<telerik:RadCartesianChart Grid.Column="0" Grid.Row="1" x:Name="trfChart1" Palette="Windows8" Zoom="5,1">

 

in cs Code

1.// this.myChart.Zoom = new Size(5, 1) already setting Zoom property     
2.string filename = "C:\\ExportedChart.png";
3.using (System.IO.Stream fileStream = System.IO.File.Open(filename, System.IO.FileMode.OpenOrCreate))
4.{
5.   this.trfChart1.Zoom = new Size(1, 1); // When before Export Zoom Property set Zoom 1, 1
6.   Telerik.Windows.Media.Imaging.ExportExtensions.ExportToImage(this.trfChart1, fileStream, new System.Windows.Media.Imaging.PngBitmapEncoder());
7.
8.// But Export result is still Zoom 5, 1 setting

 

 please give advise 

 

 

 

 

Martin Ivanov
Telerik team
 answered on 10 Nov 2015
3 answers
192 views
Hello.
In the examples I found the solution that use the RadRichTextBox to print a Chart. As for me, it looks a little strange. So, I use something like this:

public class ChartPrintBehaviour
{
    private const double ImageMargin = 100;
    private const double PageMargin = 10;
 
    private readonly RadChart chart;
 
    private readonly string header;
 
    private readonly bool portrait;
 
    public static readonly DependencyProperty IsEnabledProperty = DependencyProperty.RegisterAttached("IsEnabled", typeof(bool), typeof(ChartPrintBehaviour), new PropertyMetadata(false, IsEnabledChanged));
     
    public static readonly DependencyProperty HeaderProperty = DependencyProperty.RegisterAttached("Header", typeof(string), typeof(ChartPrintBehaviour));
 
    public static readonly DependencyProperty PortraitProperty = DependencyProperty.RegisterAttached("Portrait", typeof(bool), typeof(ChartPrintBehaviour));
 
    public ChartPrintBehaviour(RadChart chart, string header, bool portrait)
    {
        this.chart = chart;
        this.header = header;
        this.portrait = portrait;
    }
 
    public static void SetIsEnabled(DependencyObject dependencyObject, bool isEnabled)
    {
        dependencyObject.SetValue(IsEnabledProperty, isEnabled);
    }
 
    public static bool GetIsEnabled(DependencyObject dependencyObject)
    {
        return (bool)dependencyObject.GetValue(IsEnabledProperty);
    }
 
    public static void SetHeader(DependencyObject dependencyObject, string header)
    {
        dependencyObject.SetValue(HeaderProperty, header);
    }
 
    public static void SetPortrait(DependencyObject dependencyObject, bool portrait)
    {
        dependencyObject.SetValue(PortraitProperty, portrait);
    }
 
    private static void IsEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
    {
        var chart = d as RadChart;
        if (chart == null)
        {
            return;
        }
 
        if (!((bool)e.NewValue))
        {
            return;
        }
        var header = d.GetValue(HeaderProperty);
        var beh = new ChartPrintBehaviour(chart, header == null ? string.Empty : header.ToString(), (bool)d.GetValue(PortraitProperty));
        beh.Attach();
    }
 
    private void Attach()
    {
        chart.CommandBindings.Add(new CommandBinding(ApplicationCommands.Print, PrintExecuted, CanPrintExecute));
    }
 
    private void CanPrintExecute(object sender, CanExecuteRoutedEventArgs e)
    {
        e.CanExecute = chart != null;
    }
 
    private void PrintExecuted(object sender, ExecutedRoutedEventArgs e)
    {
        if (chart == null)
        {
            return;
        }
 
        var dlg = new PrintDialog { PrintQueue = LocalPrintServer.GetDefaultPrintQueue() };
        dlg.PrintTicket = dlg.PrintQueue.DefaultPrintTicket;
        if (!portrait)
        {
            dlg.PrintTicket.PageOrientation = PageOrientation.Landscape;
        }
 
        if (!dlg.ShowDialog().GetValueOrDefault())
        {
            return;
        }
 
        var doc = new FlowDocument
        {
            PageWidth = dlg.PrintableAreaWidth - PageMargin,
            PageHeight = dlg.PrintableAreaHeight - PageMargin
        };
 
        FillDocument(doc);
 
        var writer = PrintQueue.CreateXpsDocumentWriter(dlg.PrintQueue);
        writer.Write(((IDocumentPaginatorSource)doc).DocumentPaginator, dlg.PrintTicket);
    }
 
    protected virtual void FillDocument(FlowDocument doc)
    {
        var bi = new BitmapImage();
        bi.BeginInit();
        bi.CacheOption = BitmapCacheOption.OnLoad;
        var ms = new MemoryStream();
        chart.ExportToImage(ms, new PngBitmapEncoder());
        bi.StreamSource = ms;
        bi.EndInit();
         
        var img = new Image
        {
            Source = bi,
            Stretch = Stretch.Uniform,
            Height = doc.PageHeight - ImageMargin,
            Width = doc.PageWidth - ImageMargin,
            VerticalAlignment = VerticalAlignment.Top
        };
 
        Run headerRun = null;
        if (!string.IsNullOrEmpty(header))
        {
            headerRun = new Run(header);
        }
 
        var fig = new Figure
        {
            VerticalAnchor = FigureVerticalAnchor.ContentTop,
            HorizontalAnchor = FigureHorizontalAnchor.ContentCenter
        };
 
        if (headerRun != null)
        {
            fig.Blocks.Add(new Paragraph(headerRun) { TextAlignment = TextAlignment.Center });
        }
 
        var block = new BlockUIContainer(img);
        fig.Blocks.Add(block);
 
        doc.Blocks.Add(new Paragraph(fig));
    }
}

After that we can print any Chart with the this code:

  <telerik:RadChart TelerikExtentions:ChartPrintBehaviour.Header="Print Header"
                          TelerikExtentions:ChartPrintBehaviour.IsEnabled="True">
 <telerik:ChartArea.ContextMenu>
      <ContextMenu>
           <MenuItem Header="Print" Command="Print" />
      </ContextMenu>
</telerik:ChartArea.ContextMenu>
 
Evgenia
Telerik team
 answered on 10 Nov 2015
2 answers
114 views

Hi, downloaded the latest version of the WPF components (2015.3.1104) a couple of days ago. When I upgraded a project to the latest version, I noticed that styles applied at the Gridview stopped working. The window is just blank and no visual grid at all.

I created a new project from scratch, converted it to Telerik application and created a resource dictionary with a simple style. (Se attached files)

Same problem. No visual grid in window. Am I doing something wrong?

 MainWindow.xaml
<telerik:RadGridView Name="testgrid" Style="{StaticResource BaseGrid}"/>

App.xaml
<Application x:Class="WpfApplication3.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:WpfApplication3" StartupUri="MainWindow.xaml">

    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Telerik.Windows.Themes.Expression_Dark;component/Themes/System.Windows.xaml" />
                <ResourceDictionary Source="/Telerik.Windows.Themes.Expression_Dark;component/Themes/Telerik.Windows.Controls.xaml" />
                <ResourceDictionary Source="/Telerik.Windows.Themes.Expression_Dark;component/Themes/Telerik.Windows.Controls.Input.xaml" />
                <ResourceDictionary Source="/Telerik.Windows.Themes.Expression_Dark;component/Themes/Telerik.Windows.Controls.GridView.xaml" />
                <ResourceDictionary Source="Styles.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>

 

 Styles.xaml
    <Style x:Key="BaseGrid" TargetType="telerik:RadGridView">

        <Setter Property="GridLinesVisibility" Value="Both"/>
        <Setter Property="RowIndicatorVisibility" Value="Collapsed"/>
        <Setter Property="AutoGenerateColumns" Value="False"/>
    </Style>​

Johan
Top achievements
Rank 1
 answered on 10 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
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?