Telerik Forums
UI for WPF Forum
1 answer
220 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
258 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
160 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
2 answers
359 views
Hi,

I have a RadContextMenu inside a RadGridView and it works fine. So each row in RadGridView has is own RadContextMenu.
Now I would like to add some shortcut keys in order to get a context menu open in some submenu or to "click" automatically a submenu.

What do you suggest?

Thanks,

Rosen Vladimirov
Telerik team
 answered on 05 Dec 2012
5 answers
299 views
Hello there, I am assigning my axis in the following manner:
((Telerik.Windows.Controls.ChartView.ScatterPointSeries)xRadChartView_Cartesian.Series[0]).XValueBinding =
new Telerik.Windows.Controls.ChartView.GenericDataPointBinding<System.Data.DataRow, Int32?>()
{
ValueSelector = row => (Int32?)row["ColumnHeader"]
};

This is so that a chart can be created with an axis that could contain null values.  However, when those null values are present, I instead receive an exception at the code above, but only at the point when I am setting the chart data source.  The exception is an InvalidCastException and says that the 'Specified cast is not valid.'.  This only happens if the null values are present.  If they are normal ints then it all works as expected.

Is there an extra step I need to take to allow the chart to deal with these null values?  Either by displaying them as zeroes or just missing them out entirely, leaving just gaps?  The latter would be much more preferable.

Thanks in advance.
Nick
Telerik team
 answered on 05 Dec 2012
3 answers
370 views
I'm using the RadGridView to display a status list to the user, containing all the alarms of the system.
This list is usually filtered on all active alarms, meaning that once an alarm is acknowledged by the user or the system, it should disappear from the filtered list. (but not from the collection, only the filtered list).

However, when the acknowledged property (complete with OnPropertyChanged) is changed, the grid now displays the changed value, but the filter does not filter the item away. How can I achieve this?

I made a sample project describing the problem, but I can't upload it.
Rossen Hristov
Telerik team
 answered on 05 Dec 2012
0 answers
111 views
Hi,

I was wondering if the WPF control suite had anything to support notification bars? Similar to those made popular by JavaScript in the last couple of years.  http://www.hellobar.com/solo/ is an example of what I'm talking about.

Thanks Ed.


Edward Wilde
Top achievements
Rank 1
 asked on 05 Dec 2012
1 answer
159 views
Hi

I have a specific requirement that involves removing a number of annotation ranges at a time.  The only way I can see of doing this is via the Document "Delete" commands to remove them one at a time (some of these are read only ranges, so I can't just create a selection across them all and Delete the selection).

I've stepped through the code and the process of removing these individually called "EnsureDocumentArrangedAndMeasured" after each one is removed, which for a large file absolutely kills the performance.  Is there any way I can improve this?

Thanks

Charlie
Boby
Telerik team
 answered on 05 Dec 2012
2 answers
268 views
I have an Expander that I set IsEnabled="False", but I want to know if user clicks on it so that I can display a message.

Please point me to an example on how to capture that mouse click (MouseDown for example)?

Thanks
Darin
Top achievements
Rank 1
 answered on 05 Dec 2012
4 answers
385 views
I need to do the roughly the same thing as described here:
http://www.telerik.com/community/forums/wpf/chart/group-by-date-and-stack-by-itemtype.aspx

but with some important differences:
I am polling a device for data.  I add rows to my data source and bars to my chart in the elapsed event of a timer.  So I need to update my chart in real time. 
My data source looks like this:
MyClass
{
DateTime PeriodEnd
string Source
int Value
}
Where PeriodEnd is the value for the X axis, Source is how the data is grouped within each PeriodEnd, and value is the quantity to be plotted for each group (Source).

I dont know in advace what the values for Source will be or how many unique values there will be.  I just need to take all the rows for a given PeriodEnd, and chart the value for each Source.

Can you kindly point me to an example that will show me how to do this?  This is my first project with Telerik - sorry I'm an newbie.
Sam
Top achievements
Rank 1
 answered on 04 Dec 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
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?