Telerik Forums
UI for WPF Forum
1 answer
94 views
I created a test project and used the Metro style resource dictionary provided with the WPF tools to create the look for our project's scheduler.  However, moving the style over to the main project, none of the visuals are working--Drag & Drop time markers don't appear, nor does a mouse-over for the cells indicating which cell you are on.  Resizing appointments also lacks visuals.  It's like the scheduler is completely static in terms of visual cues.  Unfortunately I haven't been able to reproduce this in a sample project, and our main project's code isn't practical to post.  I'm hoping someone has encountered this and can offer some suggestions. I've attached a screen grab showing the setup of our day view just to add a little context.
Vladi
Telerik team
 answered on 06 Dec 2012
3 answers
195 views
Hi,

I have stantard MVVM scenario, when I exposed ReadOnlyObservableCollection as a public property on my ViewModel. I add or remove items by commands, because it involves additional domain logic. I dont want to make the source collection public to ensure consistency of my model.

In treeview I solved it nicely with PreviewDragEnded="RadTreeView_PreviewDragEnded"
How to do it with RadListBox?

Thanks.
Daniel 
Vladi
Telerik team
 answered on 06 Dec 2012
5 answers
609 views
Hi,

Im trying to use RadRichTextBox together with the Ribbon control to get a Word-like text editor in my application.

So far I've initialized the editor with some content, which can be either plain text, RTF of HTML, so I used the different format providers and its working like a charm.

Now I want to be able to insert content at the caret position. For inserting plain text, I'm using the Insert method, and its working fine, but how do I insert RTF and HTML? On top of that, the inserted RTF or HTML should keep its original formatting and style.

/giereck


Stefan
Telerik team
 answered on 06 Dec 2012
3 answers
322 views
Let me start this with, I am using the Q2 2012 version and this is my first attempt at using this control...

I am trying to use the pie chart to render data from database based on the dates entered by the user.  The user can reset these dates at any time and in which case I need to update the pie chart based on the new dates.  I have done this by setting up events and when the user enters the date, then I will refresh my pie chart data.

Problem 1) So at first I figured the easiest way to do this would be clear the points and re-add them.  However, this would throw an error stating index out of range.  In debug this was looking for the PieSeries.cs file.  You can reproduce this by displaying some data and then on the click of a button call pieChart.Series[0].DataPoints.Clear().  I can provide a call stack if necessary.

Problem 2) I then went back and added all the required datapoints in xaml and gave them a name.  I then changed it to use those named points and reset the values.  Now when I update the values and the labels, the chart itself is not updating.  Is there some call to tell the chart to re-evaluate the values?

Problem 3) When the user selects a date range that does not contain any data to be displayed, I need to update the chart to reflect this.  I currently set the points value to 0, but it doesn't update to reflect 0 values.  What is the best way to accomplish this?

Problem 4) When the user is hovering over a slice in the pie, I want to either be able to "explode" that slice or at least update the tooltip to reflect some other internal data.  I noticed in posts from the past that the "explode" event was ready, but is it ready now?  If so then what is the event?  If this event is not there then could you at least tell me how in the TooltipOpening even I can get the datapoint that the mouse is currently hovering over?

Thanks in advance for your time and efforts.
Lee Keel
Ves
Telerik team
 answered on 06 Dec 2012
0 answers
88 views
Hi All,

I am having 15 columns in my RadGridview. In the UI it shows 10 columns to see other 5 column i have to scroll horizontally. When i reorder the column,horizantal scroll bar is not scrolling some thing like in the screenshot. Is there any way to enable the horizontal scrollbar to move when i reorder? Please advise me on this.

Check the screenshot below :



Sakthi
Top achievements
Rank 1
 asked on 06 Dec 2012
7 answers
214 views
Hi,

For many properties I often initialise the underlying field in the get accessor. ie
public User SelectedCreatedBy
        {
            get
            {
                if (_SelectedCreatedBy != null)
                    _SelectedCreatedBy = new User();
                return _SelectedCreatedBy;
            }
            set
            {
                if (_SelectedCreatedBy != value)
                {
                    _SelectedCreatedBy = value;
                    RaisePropertyChanged(() => SelectedCreatedBy);
                }
            }
        }
But binding "SelectedItem" to this property crashes the program when I start typing. If I remove the initialisation part, it works. ie:
public User SelectedCreatedBy
        {
            get
            {
                return _SelectedCreatedBy;
            }
            set
            {
                if (_SelectedCreatedBy != value)
                {
                    _SelectedCreatedBy = value;
                    RaisePropertyChanged(() => SelectedCreatedBy);
                }
            }
        }

Was this a design decision with RadAutoCompleteBox or a bug? I've never had this problem with any other telerik controls.
Peter
Top achievements
Rank 1
 answered on 06 Dec 2012
0 answers
183 views
I would like to have the gridview paging size dynamically adjusted when gridview height changed, so that the grid would not have any void, nor would user require to scroll up and down.

I handled the gridview's SizeChanged event and tried the following code:

private void ItemsList_SizeChanged(object sender, SizeChangedEventArgs e)
{
    if (e.HeightChanged && ItemsList.ActualHeight > 0)
    {
        var pageSize = (int)(ItemsList.ActualHeight / ItemsList.RowHeight);
        if (ItemsList.ShowColumnHeaders)
            pageSize--;
        if(pageSize > 0)
            ItemPager.PageSize = pageSize;
    }
}

It pretty much worked, except when the column header is visible, as it the taller than the row height, the above calculation is not exact anymore. It also doesn't handle when horizontal scrollbar is visible.

Is there a better way to calculate the number of rows that should be visible?
Wenrong
Top achievements
Rank 1
 asked on 05 Dec 2012
1 answer
182 views
Note in the attached file that the gradient is applied to each individual value that makes up the bar fragment.
I want to set the gradient fill so it is applied only once to the fragment of the bar where it belongs.  How do I do that?
Thanks
<Window.Resources>
          
        <DataTemplate x:Key="AETemplate">
            <Rectangle>
                <Rectangle.Fill>
                    <RadialGradientBrush>
                        <GradientStop Color="#FF6DA7B6"/>
                        <GradientStop Color="#FF077085" Offset="1"/>
                    </RadialGradientBrush>
                </Rectangle.Fill>
            </Rectangle>
        </DataTemplate>
  
  
        <DataTemplate x:Key="STPTemplate">
            <Rectangle>
                <Rectangle.Fill>
                    <RadialGradientBrush>
                        <GradientStop Color="#FFE0DFDA"/>
                        <GradientStop Color="#FFC2BE57" Offset="1"/>
                    </RadialGradientBrush>
                </Rectangle.Fill>
            </Rectangle>
        </DataTemplate>
  
  
        <Style TargetType="{x:Type telerik:BarSeries}" x:Key="AEStyle">
            <Setter Property="Background">
                <Setter.Value>
                    <RadialGradientBrush>
                        <GradientStop Color="#FF6DA7B6"/>
                        <GradientStop Color="#FF077085" Offset="1"/>
                    </RadialGradientBrush>
                </Setter.Value>
            </Setter>
        </Style>
  
  
        <Style TargetType="Border" x:Key="STPStyle">
            <Setter Property="Background">
                <Setter.Value>
                    <RadialGradientBrush>
                        <GradientStop Color="#FFE0DFDA"/>
                        <GradientStop Color="#FFC2BE57" Offset="1"/>
                    </RadialGradientBrush>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition></RowDefinition>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>
          
        <chart:RadCartesianChart x:Name="theChart">
            <chart:RadCartesianChart.HorizontalAxis>
                <chartView:CategoricalAxis FontFamily="Segoe UI" FontSize="12"  />
            </chart:RadCartesianChart.HorizontalAxis>
            <chart:RadCartesianChart.VerticalAxis>
                <chartView:LinearAxis FontFamily="Segoe UI" FontSize="12"
                                    Title="The Chart" 
                                    Minimum="0" Maximum="150"   />
            </chart:RadCartesianChart.VerticalAxis>
            <chart:RadCartesianChart.Grid>
                <chartView:CartesianChartGrid MajorLinesVisibility="XY" />
            </chart:RadCartesianChart.Grid>
        </chart:RadCartesianChart>
          
        <StackPanel Orientation="Horizontal" Grid.Row="1">
            <TextBox x:Name="tb" Height="30" Width="100"></TextBox>
            <Button Content="Click" Click="Button_Click" Height="30" Width="150" ></Button>
        </StackPanel>
    </Grid>
</Window>

private void AddSeries(string tag)
        {
            if(GroupedDataGroups == null)
                GroupedDataGroups = GroupedData.Groups.Cast<GroupingImpl<string, LoadStatistic>>();
  
            Style style;
            DataTemplate template;
  
            if (theChart.Series.Count == 0)
            {
                style = FindResource("AEStyle") as Style;
                template = FindResource("AETemplate") as DataTemplate;
            }
            else if (theChart.Series.Count == 1)
            {
                style = FindResource("STPStyle") as Style;
                template = FindResource("STPTemplate") as DataTemplate;
            }
            else
            {
                style = null;
                template = null;
            }
              
            var itemsSource = GroupedDataGroups.Where(x => x.Key.ToString() == tag).First().Items;
  
            var series = new Telerik.Windows.Controls.ChartView.BarSeries 
            
                Tag = tag,
                CombineMode = ChartSeriesCombineMode.Stack,
                CategoryBinding = new PropertyNameDataPointBinding("PeriodEnding"),
                ValueBinding = new PropertyNameDataPointBinding("TradeCount"),
                ItemsSource =  itemsSource,
                  
                //,  DefaultVisualStyle = style
            };
            series.PointTemplates.Add(template);
            theChart.Series.Add(series);
        }

Sam
Top achievements
Rank 1
 answered on 05 Dec 2012
2 answers
218 views
I have a grid with the setting EditTriggers="TextInput,CellClick".  Text input seems to be triggered  by text with modifier keys, e.g. Ctrl-T, Alt-T.  I want to disable this behavior so that only text without a modifier puts the cell into edit mode.

I've tried using a custom keyboard command provider, but it appears that the default ProvideCommandsForKey() doesn't return commands for text input, and that there must be some other mechanism that triggers the edit mode.

How can I prevent text input with modifier keys from triggering edit mode.

Thanks,
-Jeff


Jeff
Top achievements
Rank 1
 answered on 05 Dec 2012
2 answers
138 views
Hi everyone,

I have a problem: I use a RadRichTextBox and in code(in runtime) by button click event I insert a Table
with InlineUIContainers in each cell - everything is OK, but when I drag it using a Table aborner by mouse(a small cross in the left top of table) then all InlineUIContainers are removed!!! If cell contains just a Paragraph and span inside it - everithyng is OK, but
I need to use an InlineUIContainers with a Border and TextBlock element as implemented below in method

InitDataCell(...)

 

private void InsertDynamicTable(DynamicTableViewModel dynamicTableViewModel)
{
            var table = new Table();
            TableRow r1 = new TableRow();
            r1.Cells.Add(new TableCell());
            r1.Cells.Add(new TableCell());
            r1.Cells.Add(new TableCell());
            table.Rows.Add(r1);
 
            TableRow r2 = new TableRow();
            r2.Cells.Add(new TableCell());
            r2.Cells.Add(new TableCell());
            r2.Cells.Add(new TableCell());
            table.Rows.Add(r2);
 
            TableRow r3 = new TableRow();
            r3.Cells.Add(new TableCell());
            r3.Cells.Add(new TableCell());
            r3.Cells.Add(new TableCell());
            table.Rows.Add(r3);
 
            table.Tag = dynamicTableViewModel.ID.ToString();
            table.Borders = new TableBorders(new Border(dynamicTableViewModel.BorderThikness, BorderStyle.Single, dynamicTableViewModel.BorderColor));
 
            table.PreferredWidth = new TableWidthUnit(TableWidthUnitType.Fixed, dynamicTableViewModel.Width);
            table.LayoutMode = TableLayoutMode.Fixed;
 
            TableRow dataRow = table.Rows.ToArray().ToList()[1];
            List<TableCell> dataCells = dataRow.Cells.ToArray().ToList();
 
            List<double> dataCellHeights = new List<double>();
 
            for (int i = 0; i < dynamicTableViewModel.DynamicColumns.Count; i++)
            {
                TableCell dataCell = dataCells[i];
 
                InitHeaderCell(headerCell, dynamicTableViewModel.DynamicColumns[i]);
                      
                     //Initialize existant TableCell
                double dataCellHeight = InitDataCell(dataCell, dynamicTableViewModel.DynamicColumns[i]);

                dataCellHeights.Add(dataCellHeight);
            }
 
            UpdateRowHeight(dataRow, dataCellHeights);
            this.richEditor.InsertTable(table); 
             
            this.richEditor.UpdateEditorLayout();
            this.richEditor.Document.UpdateAllFields();
            this.richEditor.Document.UpdateLayout();                 
}
 
private double InitDataCell(TableCell dataCell, DynamicColumnViewModel columnVm)
{
            double cellHeight = 0;
 
            dataCell.PreferredWidth = new TableWidthUnit(TableWidthUnitType.Fixed, columnVm.Width);
            dataCell.TextAlignment = RadTextAlignment.Left;
            dataCell.VerticalAlignment = RadVerticalAlignment.Center;
            var paragraph = new Paragraph();
            paragraph.TextAlignment = RadTextAlignment.Right;
            dataCell.Blocks.Add(paragraph);
 
            dataCell.Background = columnVm.DynamicCellData.Background;
 
            Grid grid = new Grid();
 
            var tb = new TextBlock
            {
                Text = columnVm.DbColumnName,
                HorizontalAlignment = System.Windows.HorizontalAlignment.Right,
                Tag = columnVm.DbColumnName,
                FontSize = columnVm.DynamicCellData.FontSize,
                Background = new SolidColorBrush(columnVm.DynamicCellData.Background),
                Foreground = new SolidColorBrush(columnVm.DynamicCellData.Foreground),
                FontFamily = columnVm.DynamicCellData.FontFamily,
                FontWeight = columnVm.DynamicCellData.FontWeight,
                FontStyle = columnVm.DynamicCellData.FontStyle,
                TextDecorations = columnVm.DynamicCellData.TextDecoration
            };
 
            tb.VerticalAlignment = VerticalAlignment.Bottom;
            tb.HorizontalAlignment = HorizontalAlignment.Right;
 
            System.Windows.Controls.Border border = new System.Windows.Controls.Border();
            border.BorderThickness = new Thickness(0);
            border.BorderBrush = Brushes.Transparent;
            border.Background = new SolidColorBrush(columnVm.DynamicCellData.Background);
            border.VerticalAlignment = VerticalAlignment.Center;
            border.HorizontalAlignment = HorizontalAlignment.Center;
            border.Child = tb;                                 
 
            border.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
 
            Size s = new Size(border.DesiredSize.Width + 1, tb.DesiredSize.Height - 1);
            var uic = new InlineUIContainer(border, s);           
 
            paragraph.Inlines.Add(uic);
 
            cellHeight = uic.Height + 5;
 
            return cellHeight;
}

Alexander
Top achievements
Rank 1
 answered on 05 Dec 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?