Telerik Forums
UI for WPF Forum
1 answer
429 views
Hello,

How can I show a specific text string when a RadListBox instance is empty?

I tried defining a style to accomplish this goal, like this:

<Style TargetType="telerik:RadListBox" x:Key="ListStyle" BasedOn="{StaticResource {x:Type telerik:RadListBox}}">
    <Style.Triggers>
        <DataTrigger Binding="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Items.Count}" Value="0">
            <Setter Property="HorizontalAlignment" Value="Center"/>
            <Setter Property="VerticalAlignment" Value="Top"/>
            <Setter Property="Margin" Value="0, 20, 0, 0"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <TextBlock Foreground="DimGray" TextWrapping="Wrap" FontSize="14">
                            There are currently no items to show.
                        </TextBlock>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </DataTrigger>
    </Style.Triggers>
</Style>

I then attach it to the RadListBox instance:

<telerik:RadListBox  Style="{StaticResource ListStyle}">
   // items here
</telerik:RadListBox>

This actually works, for the most part... but it has a fatal flaw - the RadListBox scrollbars are no longer correctly themed.

Is there another way of accomplishing this goal? Or could I get some help in tweaking the style above so that the vertical scrollbar has the correct "Windows7" theme applied to it?
Masha
Telerik team
 answered on 13 Nov 2012
2 answers
371 views
Hi,

I made a categorical chart with a bar series definition and a line series definition. The x-axis label always seems to be the category name. How can I change it to something else? I have a custom class with various properties such as XValue, YValue, XCategory and Label. I have tried a few different things as suggested in other posts on the forum, but they don't seem to work and the item on the x-axis is always labelled according to the category.

I have tried setting the item label format in the series mapping (I tried #LABEL and "#DATAITEM.Label") and I have added the item mappings as well, but it still shows the XCategory instead of the label.

var seriesDefinition = new BarSeriesDefinition
            {
                ShowItemLabels = false,
                ShowItemToolTips = true,
                ItemToolTipFormat = "#DATAITEM.Label",
                ItemLabelFormat = "#DATAITEM.Label",
                EmptyPointBehavior = emptyPointBehavior
            };

seriesMapping.ItemMappings.Add(new ItemMapping("XValue", DataPointMember.XValue));
seriesMapping.ItemMappings.Add(new ItemMapping("YValue", DataPointMember.YValue));            
seriesMapping.ItemMappings.Add(new ItemMapping("XCategory", DataPointMember.XCategory));
seriesMapping.ItemMappings.Add(new ItemMapping("Label", DataPointMember.Label));

I have also tried the following:

chart.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "#DATAITEM.Label"; and chart.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "#LABEL"; 

Any help would be appreciated.
Petar Kirov
Telerik team
 answered on 13 Nov 2012
0 answers
148 views
  Hi EveryOne!
      i'm from china. person don't use English very often.
How to can the Controls language. pls look the pics.            
Zhang
Top achievements
Rank 1
 asked on 13 Nov 2012
6 answers
724 views
I am trying to change the track ball info, but I cannot figure out the right combination to get the data to come out the way I need it to come out. I want to show an identifier for a line series in much the same way that the ChartView demo does, but in that demo, the series and format strings are encoded into the XAML. In my app, there can be any number of line series, so they need to be created programmatically.

Here is the class that holds the data:
public class SalesInfo
{
    public string Employee { get; set; }
    public DateTime Time { get; set; }
    public int Value { get; set; }
}

And here is where I am creating the data and setting the item source of my line series:
data = new RadObservableCollection<SalesInfo>(data.OrderBy(x => x.Time));
 
Color dataColor = colorArray[loopCounter % 4];
 
LineSeries line = new LineSeries();
line.Stroke = new SolidColorBrush(dataColor);
line.StrokeThickness = 2;
line.CategoryBinding = new PropertyNameDataPointBinding() { PropertyName = "Time" };
line.ValueBinding = new PropertyNameDataPointBinding() { PropertyName = "Value" };
line.ItemsSource = data;
var tbiTemplate = this.Resources["theTemplate"] as DataTemplate;
line.TrackBallInfoTemplate = tbiTemplate;
activitiesAddedChart.Series.Add(line);

And finally the template in the resources:
<DataTemplate x:Key="theTemplate">
    <StackPanel Orientation="Horizontal">
        <TextBlock Text="{Binding DataPoint.SalesInfo.Employee}" />
        <TextBlock Text=": " />
        <TextBlock Text="{Binding DataPoint.Value}" />
    </StackPanel>
</DataTemplate>

I cannot figure out how to get this bound correctly so that I can see the Employee name in the track ball info. I get the Value fine, and if I use DataPoint.Category, I can get the date, but I just cannot figure out how to get the Employee to show up in that first TextBlock in the template. Thanks.

Tsvetie
Telerik team
 answered on 13 Nov 2012
1 answer
159 views
Hi, 
I use 2 screens and when I implement keytips they don't appear in the right position related to my application.
(I open up my application on my right screen, the "main display screen", but when I trigger the keytips they appear on my left screen...!)

Are there any settings I have to apply to "connect" the keytips to my application in any way...so that they always appear "in the right position" related to my app?

I've enabled keytips in my xaml and in the code-behind file I do this:
var keyGesture = new KeyGesture(Key.LeftAlt);
ribbon.SetValue(KeyTipService.AccessKeyProperty, keyGesture);
Stefan
Telerik team
 answered on 13 Nov 2012
3 answers
191 views

1.In the radrichtextbox , setting the page number, from 1 to N, it could be shown in the radrichtextbox correctly, but when calling window's printing function, all the pages's number is 1.

2.How to transter the Landscape of PrintDialog to the RadRichTectBox.

Robert
Top achievements
Rank 1
 answered on 12 Nov 2012
6 answers
411 views
Hi,

I am having trouble binding a class with 2 members to a RadGridView. The first member contains a dictionary to set the column header text and the second to fill the grid.

here is my sample project

cs

public Content()
{
      
    // Get the labels from database
    ContextSource.Labels = DictionaryFromDatabase();
    // Get grid data from database
    ContextSource.DataSrc = DataTableFromDatabase();
      
    Listing.DataContext = ContextSource;
}
  
public class ContextSource
{
  
    public DataTable DataSrc { get; set; }
    public Dictionary<string, string> Labels { get; set; }
      
    public ContextSource()
    {
        DataSrc = new DataTable();
        Labels = new Dictionary<string, string>;
    }
}

xaml
<telerik:RadGridView Margin="0"
                              
    AreRowDetailsFrozen="True"
    AutoGenerateColumns="False"
    CanUserFreezeColumns="False"
    IsReadOnly="True"
    ItemsSource="{Binding}" 
    SelectionMode="Single"
    ShowInsertRow="False"
    x:Name="Listing">
  
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn Header="{Binding Labels.[str_label0]}" DataMemberBinding="{Binding Path=DataSrc.[columnname0]}"/>
        <telerik:GridViewDataColumn Header="{Binding Labels.[str_label1]}" DataMemberBinding="{Binding Path=DataSrc.[columnname1]}"/>
        <telerik:GridViewDataColumn Header="{Binding Labels.[str_label2]}" DataMemberBinding="{Binding Path=DataSrc.[columnname2]}"/>
    </telerik:RadGridView.Columns>
</telerik:RadGridView>

When I set Listing.DataContext = ContextSource, it will only fill the header text property. The grid is not populated.

If I direct the Listing.DataContent directly to ContextSource.DataSrc then the grid is populated, but the headers are not set.
Listing.DataContext = ContextSource.DataSrc;


Any idea what I am doing wrong?

Kind regards,
Dennis


Maya
Telerik team
 answered on 12 Nov 2012
1 answer
135 views

Hi,

 

I use the last (Q3 2012) version of WPF controls. And I noticed that it can't get  multilevel list (1.-1.1-1.1.1. for example)  as it would be expected.  The indent buttons behavior also doesn't work properly.

 

I would appreciate your advice or comments.

Igor


Vasil
Telerik team
 answered on 12 Nov 2012
5 answers
1.1K+ views
Hi There,

I'm finding myself a bit stumped as to how to set the position of the tabs on the tab control if the placement is set to go along the left or right as per the attached image.

what it does right now is place the tabs from the bottom going up, but i would prefer to have them go from the top down...

is there a way to set this??

Thanks,
Nemanja
Pavel R. Pavlov
Telerik team
 answered on 12 Nov 2012
1 answer
156 views

Hi,

The scenerio we are working on:

  • User A opens a template (docx) with RadRichTextBox.
  • Template has two MergeFields, "Subject" and "Signed".
  • User A updates the document and "Subject" MergeField is set to "User A's Subject".
  • Then User A saves the document as Docx and sends it to User B.
  • User B signs the document and "Signed" MergeField should be set to "Yes", but "Subject" MergeField shouldn't be updated.

 

The problem is, when User B opens the document, application does not have the User A's MergeFieldSource. So when application merge fields, it updates both "Subject" and "Signed" MergeFields.
 

I've tried couple of solutions, one with RadRichTextBox.MergeFieldToStringConverting event and one with inheriting MergeField.

In RadRichTextBox.MergeFieldToStringConverting solution, MergeFieldToStringConvertingEventArgs doesn't have the old/original value (before merging). If it was, I could pass the old value to the "Subject" MergeField when User B updates the document.

In CustomField implementation, I could have find a solution, if there were a functionality like; when protected override DocumentFragment GetResultFragment() method returns null, corresponding MergeField does not updates it's own value. But there is no such a functionality.

One another solution could be, enumerating the MergeFields in the document and update only the required ones. (This is possible in Office Word API). But I couldn't find a way to achieve the is with RadRichTextBox.

I've added a sample solution demonstrating the scenerio. (Using Telerik version 2012.3.1017.45)

Regards.

Iva Toteva
Telerik team
 answered on 12 Nov 2012
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
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?