Telerik Forums
UI for WPF Forum
1 answer
162 views

Hi,

 

I'm trying to create an horizontal bar chart with labels inside the bars, close the to right side of the bars, line in labels-inside.png. I have tried several things but the closest I could get to it was the labels right after the bars (see labels-outside.png). 

 

How can I get the labels inside the bars close to the right edge? Is it possible?

 

Thanks,

 

Luis Barreira

Cleanwatts
Top achievements
Rank 1
 answered on 26 Jun 2017
4 answers
165 views

I've been using ChartView for some time to create charts from a Windows service without problems. The chart control (RadCartesianChart or RadPieChart) is created and initialized in code, and then is rendered to a bitmap.

Ever since I updated the libraries to the latest version, when I try to create a pie chart, the result is always a blank image. The other chart types continue to work as expected.

The code I'm using is the following:

 

private bool CreatePieChartThread(MemoryStream stream, int width, int height)
{
    RadPieChart chart = new RadPieChart
                    {
                        Palette = BuildColorPalette(m_chartColors),
                        SmartLabelsStrategy = new PieChartSmartLabelsStrategy
                                          {
                                              DisplayMode = PieChartLabelsDisplayMode.SpiderAlignedOutwards
                                          }
                    };
 
    var labelBoxFactory = new FrameworkElementFactory(typeof(TextBlock));
    labelBoxFactory.SetValue(FrameworkElement.HorizontalAlignmentProperty, HorizontalAlignment.Center);
    labelBoxFactory.SetBinding(TextBlock.TextProperty, new Binding("Label"));
 
    var valueBoxFactory = new FrameworkElementFactory(typeof(TextBlock));
    valueBoxFactory.SetValue(FrameworkElement.HorizontalAlignmentProperty, HorizontalAlignment.Center);
    valueBoxFactory.SetBinding(TextBlock.TextProperty, new Binding("Value"));
 
    var panelFactory = new FrameworkElementFactory(typeof(StackPanel));
    panelFactory.SetValue(StackPanel.OrientationProperty, Orientation.Vertical);
    panelFactory.AppendChild(labelBoxFactory);
 
    if (m_showValuesOnPie)
        panelFactory.AppendChild(valueBoxFactory);
 
    PieSeries series = new PieSeries
                   {
                       ShowLabels = true,
                       RadiusFactor = 0.75,
                       AngleRange = new AngleRange(-90, 360),
                       LabelConnectorsSettings = new ChartSeriesLabelConnectorsSettings()
                   };
    series.LabelDefinitions.Add(new ChartSeriesLabelDefinition
                            {
                                Margin = new Thickness(-8, 0, 0, 0),
                                Template = new DataTemplate { VisualTree = panelFactory }
                            });
 
    // valores ordenados por nome e sem zeros
    foreach (var value in m_data.Where(d => d.AlarmOccurrences > 0).OrderBy(d => d.Name))
    {
        series.DataPoints.Add(new PieDataPoint
                          {
                              Label = value.Name,
                              Value = value.AlarmOccurrences,
                              OffsetFromCenter = 0.05,
                          });
    }
 
    chart.Series.Add(series);
 
    PrepareElementForExport(chart, width, height);
    ExportExtensions.ExportToImage(chart, stream, new PngBitmapEncoder());
 
    return true;
}
 
protected void PrepareElementForExport(FrameworkElement element, int width, int height)
{
    if (!element.IsInitialized)
    {
        element.BeginInit();
        element.EndInit();
    }
 
    element.Measure(Size.Empty);
    element.Measure(new Size(width, height));
 
    element.Dispatcher.Invoke(() => { });
 
    element.Arrange(new Rect(0, 0, width, height));
    element.UpdateLayout();
}

Cleanwatts
Top achievements
Rank 1
 answered on 26 Jun 2017
2 answers
403 views

Hello I have a problem selecting rows in a Radgrid with TOUCHSCREEN. At the start, one row is selected (the blue one, as you can see in the screenshot), but when I click on another row nothing happens (I just see small little circus that I'm tapping on the screen). Everythings works fine if I use a mouse attached to the tablet but doesn't work if I use finger on touchscreen. The desired result is that the row "touched" becomes blue and is the SelectedItem="{Binding SelectedItuGrid.

Just to let you know that the radiobutton and the Button X works with touch after I added this instruction:  telerik:TouchManager.IsTouchHitTestVisible ="False"   

 

This is the XAML code:

<StackPanel Grid.Row="4" telerik:TouchManager.IsTouchHitTestVisible ="False" >
                            <telerik:RadGridView x:Name="radGridUti"
                            SelectedItem="{Binding SelectedItuGrid, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"                                
                            telerik:TouchManager.IsTouchHitTestVisible ="False"   
                            telerik:ScrollingSettingsBehavior.IsEnabled="True"
                            IsReadOnly="True"
                            SelectionMode="Single"                         
                            SelectionUnit="FullRow"                                                  
                            ShowColumnSortIndexes="False"                                
ItemsSource="{Binding ItusSameGroupList, Mode=TwoWay}"                            
                            Visibility="{Binding GridItusSameGroupVisibility}"
                            Margin="0,10,0,10" >
                                <telerik:RadGridView.Columns>
                                    <telerik:GridViewDataColumn t:I18N.Translate="ITU Id" DataMemberBinding="{Binding UtiId}" Width="0" IsVisible="False" />
                                    <telerik:GridViewDataColumn t:I18N.Translate="ITU Plate" DataMemberBinding="{Binding UtiPlate}" Width="3*" />
                                    <telerik:GridViewDataColumn t:I18N.Translate="Ground" Width="3*" HeaderTextAlignment="Center">
                                        <telerik:GridViewDataColumn.CellTemplate>
                                            <DataTemplate>
                                                <RadioButton Content="{Binding RadioButtonGround}" GroupName="{Binding UtiPlate}"
                                                            HorizontalAlignment="Center"                                                         
                                                            IsChecked="{Binding IsUtiInDoubleStakerHold, 
                                                            Converter={StaticResource EnumBoolConverter}, 
                                                            ConverterParameter={x:Static views:UtiGroundUpper.Ground}, Mode=TwoWay}"
                                                            IsEnabled="{Binding IsUtiInDoubleStakerHold, 
                                                            Converter={StaticResource EnumBoolConverter}, 
                                                            ConverterParameter={x:Static views:UtiGroundUpper.Disabled}}" />
                                            </DataTemplate>
                                        </telerik:GridViewDataColumn.CellTemplate>
                                    </telerik:GridViewDataColumn>
                                    <telerik:GridViewDataColumn t:I18N.Translate="Upper" Width="3*" HeaderTextAlignment="Center">
                                        <telerik:GridViewDataColumn.CellTemplate>
                                            <DataTemplate>
                                                <RadioButton Content="{Binding RadioButtonUpper}" 
                                                            HorizontalAlignment="Center"
                                                            GroupName="{Binding UtiPlate}"
                                                            IsChecked="{Binding IsUtiInDoubleStakerHold, 
                                                            Converter= {StaticResource EnumBoolConverter}, 
                                                            ConverterParameter={x:Static views:UtiGroundUpper.Upper}, Mode=TwoWay}"
                                                            IsEnabled="{Binding IsUtiInDoubleStakerHold, 
                                                            Converter={StaticResource EnumBoolConverter}, 
                                                            ConverterParameter={x:Static views:UtiGroundUpper.Disabled}}" />
                                            </DataTemplate>
                                        </telerik:GridViewDataColumn.CellTemplate>
                                    </telerik:GridViewDataColumn>
                                    <telerik:GridViewDataColumn Width="1*" HeaderTextAlignment="Center">
                                        <telerik:GridViewDataColumn.CellTemplate>
                                            <DataTemplate>
                                                <Button 
                                                        HorizontalAlignment="Center"                                          
                                                        Visibility="{Binding Path=DeleteCommandIsVisible, Converter={StaticResource BoolToVis}, Mode=TwoWay}"
                                                        Command="{Binding Path=DataContext.ConfirmDeleteViewCommand,
                                                    RelativeSource={RelativeSource Mode=FindAncestor,      
                                                     AncestorType={x:Type UserControl}} }" 
                                                    CommandParameter="{Binding}" 
                                                        Background="Transparent"
                                                        BorderBrush="Transparent"
                                                        Height="50"
                                                        Width="100">
                                                    <fa:ImageAwesome Icon="remove" Foreground="Red" Width="32" Height="32" VerticalAlignment="Center"  
                                                     HorizontalAlignment="Center"/>
                                                </Button>
                                            </DataTemplate>
                                        </telerik:GridViewDataColumn.CellTemplate>
                                    </telerik:GridViewDataColumn>
                                </telerik:RadGridView.Columns>
                            </telerik:RadGridView>
                        </StackPanel>

 

Please let me know,

thank you.

 

Serena
Top achievements
Rank 1
 answered on 26 Jun 2017
1 answer
107 views

Hi,

I am very new to Telerik and I am trying us RichTextBox on my project.

One of the requirement is to export text to HTML5 as responsive.

My thinking is that I need to intercept, customize or subclass HtmlFormatProvider to achieve what I want.

Is intercepting, customizing or subclassing HtmlFormatProvider possible?

Or is there a way to create HTML5 in my way?

 

Thanks in advance.

 

Jaeho

Mihail
Telerik team
 answered on 26 Jun 2017
0 answers
131 views

this is a followup to the question asked here


Wouldnt it be possible to implement it the way gong-wpf-dragdrop does it without breaking mvvm?

i considerthe line below in codebehind to not break mvvm so i could be wrong.

(DataContext as ViewModel).SelectedRecord

The way gong does it is you bind the view model itself, implement an interface and handle the logic using interface implementations.

Would love to be able to handle that logic in my VM rather than using a behavior

Sara
Top achievements
Rank 1
 asked on 23 Jun 2017
3 answers
222 views

Hello.

I have built a perfectly functional usercontrol, which includes a radrichtextbox with htmldataprovider (pretty nice, pretty easy, works like a charm).

Now I need to expose it to some VB6 client :-/, so as I have done before, I just host it in a winforms form, add some COM interfaces, and it should work all the same (been there, done that...)

 

Well, no...

It keeps giving me this error:

Value cannot be null. Parameter name: formatProvider

at Telerik.Windows.Documents.FormatProviders.DataProviderBase..ctor(ITextBasedDocumentFormatProvider formatProvider, DependencyProperty stringProperty)
at Telerik.Windows.Documents.FormatProviders.Html.HtmlDataProvider..ctor()
at System.Xaml.Schema.XamlTypeInvoker.DefaultCtorXamlActivator.InvokeDelegate(Action`1 action, Object argument)
at System.Xaml.Schema.XamlTypeInvoker.DefaultCtorXamlActivator.CallCtorDelegate(XamlTypeInvoker type)
at System.Xaml.Schema.XamlTypeInvoker.DefaultCtorXamlActivator.CreateInstance(XamlTypeInvoker type)
at System.Xaml.Schema.XamlTypeInvoker.CreateInstance(Object[] arguments)
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstanceWithCtor(XamlType xamlType, Object[] args)
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstance(XamlType xamlType, Object[] args)

 

I tried:

        <telerik:HtmlFormatProvider x:Key="HtmlFormatProvider" />

    <telerik:HtmlDataProvider RichTextBox="{Binding ElementName=SocialHistoriesHtml}" FormatProvider="{StaticResource HtmlFormatProvider}" Html="{Binding HTML}" />
Richard
Top achievements
Rank 1
Iron
 answered on 23 Jun 2017
7 answers
271 views

I'm using RadGridView to show certain properties of a list of elements.
This works as expected as long as all elements in the list have all properties the columns bind to.

But once only one element does not have a property a column binds to the whole columns fails to correctly support sorting and filtering.

When sorting no element is shown at all and the filter dialog does not show any values. See attached screenshots.

This still happens even though a FallbackValue of the right type is provided in the Binding.

 

Is there a way to make this work? Sadly I can not avoid having some elements that do not implement all properties, so a failing binding most be handled in a better way. 

 

My Xaml:

<Window x:Class="WpfTestApplication.MainWindow"
        xmlns:telerikG="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
        xmlns:telerikD="clr-namespace:Telerik.Windows.Data;assembly=Telerik.Windows.Data"
        Title="MainWindow" Height="200" Width="300">
    <Grid>
        <telerikG:RadGridView ItemsSource="{Binding Elements}" AutoGenerateColumns="False">
                <telerikG:RadGridView.Columns>
                <telerikG:GridViewDataColumn Header="cost" DataMemberBinding="{Binding cost, FallbackValue=0.0}"/>
                </telerikG:RadGridView.Columns>
            </telerikG:RadGridView>
    </Grid>
</Window>
Frazz Jarvis
Top achievements
Rank 1
 answered on 23 Jun 2017
5 answers
184 views
Greetings. I'm using 2014.3.1202.45, so it's possible this is already fixed. If the computer has a network connection, but the internet is not working, there is a delay of a few seconds when initializing the map. This happens when calling Map.Providers.Insert. If there is no network connection at all, this problem does not happen. Is there a way to shorten or eliminate this delay from my side or in the code?
Jason D
Top achievements
Rank 1
Veteran
 answered on 23 Jun 2017
1 answer
241 views

So you guys flag projects by XAML and no XAML so when an upgrade is done you know which files to use.

How can one switch a project from one to the other though so the upgrade extension is aware which one you are trying to do.

Specifically I have two projects that are flagged incorrectly.

the upgrade occurs and the reference to the theme  is removed.

I then have to manually find the themes folder and add a reference.

 

Nikola
Telerik team
 answered on 23 Jun 2017
1 answer
392 views

I have been trying to create a custom filter control and I am running into issues.

 

It seems that even when writing a custom filter, the decision of whether a row will be filtered in or out is based on one or more FilterDescriptors, which basically only take in the name of the data field, one of a set of predefined operators, and the value to compare the value in the data field to.

 

Is there any way to define our own logic for whether a row will pass the filter? Any way to write in a function that will take in the row item, and let us create more complex logic than what is given out-of-the-box?

Martin Ivanov
Telerik team
 answered on 23 Jun 2017
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
Slider
Expander
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
DesktopAlert
WatermarkTextBox
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
WebCam
CardView
DataBar
Licensing
FilePathPicker
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
HighlightTextBlock
Security
TouchManager
StepProgressBar
VirtualKeyboard
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
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?