Telerik Forums
UI for WPF Forum
1 answer
144 views

Hi 

I am using latest version, and I found a problem about data binding  Min and Max in GaugeRange.

Xaml like this.

<Window x:Class="TelerikChartTest.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
        Title="MainWindow"
        Height="350"
        Width="525">
    <Window.Resources>

    </Window.Resources>
    <Grid>

        <telerik:RadRadialGauge x:Name="radialGauge"
                                Width="200"
                                Height="200"
                                telerik:StyleManager.Theme="Windows8">
            <telerik:RadialScale Name="scale"
                                 LabelRotationMode="None"
                                 Min="{Binding Path=Min}"
                                 Max="{Binding Path=Max}"
                                 StartWidth="0.1"
                                 EndWidth="0.1"
                                 MajorTicks="4">
                <telerik:RadialScale.Ranges>
                    <telerik:GaugeRange x:Name="range1" 
                                        Min="{Binding ElementName=radialGauge, Path=DataContext.Min1, NotifyOnTargetUpdated=True}"
                                        Max="{Binding ElementName=radialGauge, Path=DataContext.Max1, NotifyOnTargetUpdated=True}"
                                        Background="#FF1E8D00" />

                </telerik:RadialScale.Ranges>
            </telerik:RadialScale>
        </telerik:RadRadialGauge>
       
    </Grid>
</Window>

in cs file like this,

    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            this.Loaded += MainWindow_Loaded;

        }

        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            this.DataContext = new TestData();
          
        }
        
    }

    public class TestData : ViewModelBase
    {
        private float _min = 0;
        public float Min
        {
            get { return _min; }
            set
            {
                _min = value;
                this.OnPropertyChanged("Min");
            }
        }


        private float _min1 = 0;
        public float Min1
        {
            get { return _min1; }
            set
            {
                _min1 = value;
                this.OnPropertyChanged("Min1");
            }
        }

        private float _max = 1000;
        public float Max
        {
            get { return _max; }
            set
            {
                _max = value;
                this.OnPropertyChanged("Max");
            }
        }

        private float _max1 = 1000;
        public float Max1
        {
            get { return _max1; }
            set
            {
                _max1 = value;
                this.OnPropertyChanged("Max1");
            }
        }

    }
if I set the DataConxtext in  MainWindow_Loaded event, the display of GaugeRange  will be mess. I found if we do not set max and min value before loaded event, the display will be wrong, but in some case, the min and max value maybe get updated after loaded event, how can we handle it?

Evgenia
Telerik team
 answered on 25 Jun 2015
3 answers
934 views

Hello,

I've currently writing a control that descends from RadRichTextBox, with an additional HtmlText dependency property, so that I can  directly bind an HTML content to the RichTextBox. To avoid performances issues, the HtmlText dependency property should be updated only when the RichTextBox loses its focus.

First problem: The OnLostFocus virtual method is never called when the control loses its focus. This is contrary to the WPF guidelines: if an On<EventName> virtual method is defined it should be called to raise the event, so that descendant classes can override this method instead of adding an event handler. This has the advantage that we are sure that the control is notified before the event listeners and can act accordingly.

Second problem: The LostFocus event is called repeatidly: justr clicking on the control, when it doesn't have the focus raises it twice.

Boby
Telerik team
 answered on 25 Jun 2015
3 answers
564 views

Hello,

I have a couple of questions about the RichTextBox, I want to use this control for basic notes that are made in my application.

The user should be able to use basic format options to format the note, like bold, understrike, italics and color.

Also the text should be spellchecked, besides that I dont need any of the other features of this control.

 

I am trying to set this up, but have some questions:

  • When I set the font in XAML the font of the text remains 12, the font of my contextmenu gets smaller but not the text in the richtextbox? How can I set this font?
  • The default settings show some margins below every line, I can remove this using the contextmenu option paragraph. How can I set this in XAML?
  • Is it possible to bind to some property that specify if there are spellcheck errors in the text or the number of spellcheck error in the text? So I can for example show a messagebox before the notes are saved which will tell the user that there are still spell check errors.
  • I want to use the Alt+Enter key-combination for next line, the enter key will be used to move to the next field, I tried to implement this see below, but cant programmaticaly add a return in the text. How can I accomplish this?

 

public class RichTextbox : RadRichTextBox
{
    protected override void OnPreviewKeyDown(System.Windows.Input.KeyEventArgs e)
    {
         
        if ((Keyboard.Modifiers == ModifierKeys.Alt && Keyboard.IsKeyDown(Key.Enter)) ||
            (Keyboard.Modifiers == ModifierKeys.Alt && Keyboard.IsKeyDown(Key.Return)) ||
            (Keyboard.IsKeyDown(Key.RightAlt) && Keyboard.IsKeyDown(Key.Enter)) ||
            (Keyboard.IsKeyDown(Key.RightAlt) && Keyboard.IsKeyDown(Key.Return)))
        {
            //THIS CODE IS NOT WORKING
            XamlFormatProvider provider = new XamlFormatProvider();
            string text = provider.Export(this.Document);
            text += "\r\n";
            provider.Import(text);
            e.Handled = true;
        }
        else if (Keyboard.IsKeyDown(Key.Enter))
        {               
            this.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
            e.Handled = true;
        }
        else
        {
            base.OnPreviewKeyDown(e);
        }
    }
}

 

Regards,

 

Marcel

Boby
Telerik team
 answered on 24 Jun 2015
9 answers
564 views

 

 

 

Severity is an enum type. The below XAML doesn't work. If I compare on another property of Int type, the styles are selected just fine. I also tried to compare against the underlying constant value, but no cigar. Can I use the conditionalstyleselector on an Enum type?

<
telerik:RadGridView ItemsSource="{Binding IssuesFound}">

 

 

 

 

<telerik:RadGridView.RowStyleSelector>

 

 

 

 

<telerik:ConditionalStyleSelector>

 

 

 

 

<telerik:StyleRule Condition="Severity = Error">

 

 

 

 

<Style TargetType="telerik:GridViewRow">

 

 

 

 

<Setter Property="Background" Value="Red"/>

 

 

 

 

</Style>

 

 

 

 

</telerik:StyleRule>

 

 

 

 

<telerik:StyleRule Condition="Severity = Warning">

 

 

 

 

<Style TargetType="telerik:GridViewRow">

 

 

 

 

<Setter Property="Background" Value="Yellow"/>

 

 

 

 

</Style>

 

 

 

 

</telerik:StyleRule>

 

 

 

 

<telerik:StyleRule Condition="Severity = Information">

 

 

 

 

<Style TargetType="telerik:GridViewRow">

 

 

 

 

<Setter Property="Background" Value="Blue"/>

 

 

 

 

</Style>

 

 

 

 

</telerik:StyleRule>

 

 

 

 

</telerik:ConditionalStyleSelector>

 

 

 

 

</telerik:RadGridView.RowStyleSelector>

 

 

 

 

</telerik:RadGridView>

 

Dimitrina
Telerik team
 answered on 24 Jun 2015
1 answer
215 views

Hi telerik Team,

I want to make longer the duration of tool tip visibility in a piechart, I tried several solutions but nothing seems to work.

Settings the show duration in ChartTooltipBehavior I obtain another tooltip.

here is my xaml:

 

<telerikui:RadPieChart x:Name="telerikPieChart"
 
                       d:DataContext="{Binding Source={d:DesignInstance design:PieChartSeriesDC, IsDesignTimeCreatable=True}, Path=Series}">
 
    <telerikui:RadPieChart.Behaviors>
 
        <telerikcv:ChartTooltipBehavior ShowDuration="3600" />
 
    </telerikui:RadPieChart.Behaviors>
 
    <telerikui:RadPieChart.Series>
 
        <telerikcv:DoughnutSeries ItemsSource="{Binding Children}" ValueBinding="Value"
 
                                  DefaultSliceStyle="{StaticResource PieSliceStyle}" ShowLabels="True">
 
        </telerikcv:DoughnutSeries>
 
    </telerikui:RadPieChart.Series>
 
    <telerikui:RadPieChart.TooltipTemplate>
 
        <DataTemplate>
 
            <Border Background="Black" Opacity="0.9" CornerRadius="5" Height="Auto"
 
                    ToolTipService.ShowDuration="3600000">
 
                <StackPanel Margin="6">
 
                    <StackPanel Orientation="Vertical">
 
                        <TextBlock Foreground="White" Grid.Row="0" FontSize="13" HorizontalAlignment="Center" FontWeight="Bold" TextWrapping="Wrap">
 
                            <TextBlock.Text>
 
                                <MultiBinding StringFormat="{}{0}  {1:P2}">
 
                                    <Binding Path="DataItem.Label" />
 
                                    <Binding Path="DataItem.Percentage" />
 
                                </MultiBinding>
 
                            </TextBlock.Text>
 
                        </TextBlock>
 
                        <ListView Grid.Row="1" ItemsSource="{Binding DataItem.Children}" Height="Auto" Background="Transparent" BorderThickness="0" Focusable="False">
 
                            <ListView.ItemTemplate>
 
                                <DataTemplate>
 
                                    <Grid>
 
                                        <Grid.ColumnDefinitions>
 
                                            <ColumnDefinition/>
 
                                            <ColumnDefinition Width="5"/>
 
                                            <ColumnDefinition/>
 
                                        </Grid.ColumnDefinitions>
 
                                        <TextBlock Text="{Binding Label}" Grid.Column="0"
 
                                                   HorizontalAlignment="Left" Foreground="White" Background="Transparent"/>
 
                                        <TextBlock Grid.Column="2"
 
                                                   HorizontalAlignment="Right" Foreground="White" Background="Transparent">
 
                                            <TextBlock.Text>
 
                                                <!--<MultiBinding StringFormat="{}{0:0.00}M€({1:P2})" >-->
 
                                                <!--<Binding Path="Value" />-->
 
                                                <MultiBinding StringFormat="{}{0:P2}" >
 
                                                    <Binding Path="PercentageAncestor" />
 
                                                </MultiBinding>
 
                                            </TextBlock.Text>
 
                                        </TextBlock>
 
                                    </Grid>
 
                                </DataTemplate>
 
                            </ListView.ItemTemplate>
 
                        </ListView>
 
                    </StackPanel>
 
                </StackPanel>
 
            </Border>
 
        </DataTemplate>
 
    </telerikui:RadPieChart.TooltipTemplate>
 
    <telerikui:RadPieChart.SmartLabelsStrategy>
 
        <telerikcv:PieChartSmartLabelsStrategy DisplayMode="Spider"/>
 
    </telerikui:RadPieChart.SmartLabelsStrategy>
 
</telerikui:RadPieChart>

 

How can I set the show duration on the right tooltip?

Thank,

Giorgio

Martin Ivanov
Telerik team
 answered on 24 Jun 2015
1 answer
174 views

i have a radGrid that bind to string with delimiter such as : string: key=value;key=value;....
i bind this string to the grid by converter from string to dictionary and back.

this is the radgrid:

<telerik:RadGridView x:Name="radGrid" Grid.Column="0" Grid.Row="5" Grid.ColumnSpan="2"
            Margin="10,20,10,10"   NewRowPosition="Top"
            ItemsSource="{Binding CurrentParameter.Values,  Mode=TwoWay,
   Converter={StaticResource StringToDictConverter}}"
            AddingNewDataItem="valuesGrid_AddingNewDataItem"
            CanUserInsertRows="True" IsReadOnly="False"
            CanUserDeleteRows ="True"
            AutoGenerateColumns="False">
            <telerik:RadGridView.Columns>
                <telerik:GridViewSelectColumn/>
                <telerik:GridViewDataColumn Header="Key"  DataMemberBinding="{Binding Key}" Width="*">
                </telerik:GridViewDataColumn>
              <telerik:GridViewDataColumn Header="Value"    DataMemberBinding="{Binding Value}" Width="*">                                       </telerik:GridViewDataColumn>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>

this is the converter:

public object Convert(
              object value,
              Type targetType,
              object parameter,
              CultureInfo culture
          )
      {
          Dictionary<string, string> dict = new Dictionary<string, string>();
          if (value != null)
          {
              string[] arr = value.ToString().Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
              foreach (string s in arr)
              {
                  string[] sArr = s.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries);
                  dict.Add(sArr[0], sArr[1]);
              }
          }
          return dict;
           
      }
 
      public object ConvertBack
          (
              object value,
              Type targetType,
              object parameter,
              CultureInfo culture
          )
      {
          if (!(value is Dictionary<string, string>))
              return null;
          string sBack = "";
          foreach (KeyValuePair<string, string> item in (Dictionary<string, string>)value)
          {
              sBack += item.Key + "=" + item.Value + ";";
          }
          return sBack;
      }

the currentParameter Implements INotifyPropertyChanged.

so i want to edit the values in radGrid but it's not possible because the  keyValuePair from converter is read only!

what i can do?

Stefan
Telerik team
 answered on 24 Jun 2015
1 answer
176 views
I can't find the RadGauge in the toolbox.  Where is it located?
Martin Ivanov
Telerik team
 answered on 24 Jun 2015
5 answers
144 views

I'm currently testing out the Q1 2015 Trial before deciding to completely upgrade my application. One of the views in the application uses the RadRadialGauge with an interactive RadialScale. A custom ShaderEffect effect is applied to the root Grid in the application. When I navigate to the page containing the gauge, my application crashes with a UCEERR_RENDERTHREADFAILURE exception. If, however, I use one of the included effects (DropShadow or Blur) the app doesn't crash but the needle is no longer interactive. I have a sample solution I can provide if desired and will provide basic xaml below.

Any thoughts on what I might be able to do to either work around this problem or get an assurance this can be fixed? I'm considering the upgrade for some of the new WPF Reporting tools and I'd hate to not be able to do it because of the RadialGauge.

 

Sample MainWindow.xaml:

<Window x:Class="RadialGaugeTest.MainWindow"
        xmlns:aldis="http://schemas.aldiscorp.com/xaml/"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <!-- DropShadow -->
        <!--<Grid.Effect>
            <DropShadowEffect ShadowDepth="5" Color="#3fff" />
        </Grid.Effect>-->
         
        <!-- Blur -->
        <!--<Grid.Effect>
            <BlurEffect Radius="0.2" />
        </Grid.Effect>-->
         
        <telerik:RadRadialGauge Grid.Row="1" Grid.Column="1" x:Name="radialGauge" telerik:StyleManager.Theme="Windows8">
            <telerik:RadialScale Min="1" Max="12" IsInteractive="True">
                <telerik:RadialScale.Indicators>
                    <telerik:Needle />
                    <telerik:Pinpoint />
                </telerik:RadialScale.Indicators>
            </telerik:RadialScale>
        </telerik:RadRadialGauge>
    </Grid>
</Window>

Martin Ivanov
Telerik team
 answered on 24 Jun 2015
1 answer
142 views

Hi,

 i use a simple raddocking control. Saving and loading of the layout works fine. But after
loading all the content is empty.

 Is there a simple exmaple how to save the layout with its content?

Thanks

Best regards

Rene

Nasko
Telerik team
 answered on 24 Jun 2015
1 answer
139 views

I have simple Dictionary:

Dictionary<int, string> dictionary = new Dictionary<int, string>();

And i want my Dictionary will be merge into Chart Pie like in this example (include all the toll tips that opened after mouse over):

 http://demos.telerik.com/aspnet-ajax/salesdashboard/

 Can i have a simple code example how to achieve that ?

Martin Ivanov
Telerik team
 answered on 23 Jun 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?