Telerik Forums
UI for WPF Forum
11 answers
496 views
Using:  WPF 4.0, latest trial build of WPF controls

I'm using the RadTabControl with Prism and cannot get Region.Activate to work.  I successfully load multiple views into a RadTabControl that is defined as a Prism Region but when I want to activate one of the views already loaded as below the tab does not get selected as the new active tab.

 

Private Sub ShowChildScreen(ByVal param As ScreenActivateEventArgs)
If Not 
_screenregistry.ContainsKey(param.ScreenId) Then
    
Throw New 
InvalidOperationException(String.Format("ScreenId {0} not registered."param.ScreenId))
End If
Dim s As IScreen = 
_container.TryResolve(_screenregistry.Item(param.ScreenId))
s.ScreenSubject = 
param.ScreenSubject
Dim reg As IRegion = 
_regionManager.Regions(param.RegionName)
Dim v As Object
reg.GetView(s.ScreenKey)
If v Is Nothing Then
    reg.Add(s.View, 
s.ScreenKey)
Else
 reg.Activate(v)
End 
If
End Sub

 

 

 

 
My tab control XAML is as follows:

 

<telerik:RadTabControl cal:RegionManager.RegionName="MainWorkspaceRegion" 
Grid.Row="1" DropDownDisplayMode="Visible"
<telerik:RadTabControl.ItemContainerStyle>
<Style 
TargetType="{x:Type telerik:RadTabItem}"><Setter Property="Header" 
Value="{Binding DataContext}" /><Setter Property="HeaderTemplate"
<Setter.Value><DataTemplate><Grid
<Grid.ColumnDefinitions><ColumnDefinition Width="Auto"/> 
<ColumnDefinition Width="Auto"/></Grid.ColumnDefinitions
<TextBlock Grid.Column="0" Text="{Binding DisplayName}"/> 
<Button Command="{Binding CloseCommand}" Grid.Column="1" Content="X" 
Cursor="Hand" Focusable="False" FontFamily="Courier" 
FontSize="9" FontWeight="Bold" Margin="4,1,0,0" Padding="0" 
VerticalContentAlignment="Bottom" Width="16" Height="16" /> 
</Grid></DataTemplate> </Setter.Value
</Setter><Setter Property="Height" Value="25" /> 
<Setter Property="IsSelected" Value="True" />
</Style></telerik:RadTabControl.ItemContainerStyle
</telerik:RadTabControl>

 

 

 

 

 

Daniel
Top achievements
Rank 1
 answered on 22 Jan 2013
3 answers
286 views
Dear Telerik,

I have a license for both DevExpress and Telerik (license check required?). Currently, I would like to port a DevExpress DataGrid (WinForm) to Telerik RadGridView (WPF). The .NET framework I am using is 3.5 and I am not allowed to upgrade it to 4.5, unfortunately, so I am stuck with an older version of Telerik.

Since I am still in the process of working up a solution, the list of problems I have may change (increase) over time, but so far these are the two main issues I've encountered so far:

1. Row selection

I cannot get RadGridView to return the row indices of the selected rows. It appears later version has a SelectedRows property but my version only has SelectedCells and SelectedItems. The cell info objects, interestingly, only has information on column and not row.

2. Multithreading

The DevExpress DataGrid I am porting appears to have code that involve multithreading handling. I did a brief Google search and the way to port things like "InvokeRequired" did not seem immediately obvious. Is there like a FAQ for this topic?

Thanks for now.
New
Top achievements
Rank 1
 answered on 22 Jan 2013
2 answers
256 views
Hi, 


I'm using the gridview to show items that are defined like following code:

public class GridLine
    {
        public string Key { get; set; }
        public List<Year> Years { get; set; }
    }
 
public class Year
    {
        public string Code { get; set; }
        public int TotalValue { get { return Months != null ? Months.Sum(m => m.Value) : 0; } }
        public List<Month> Months { get; set; }
    }
 
public class Month
    {
        public string Code { get; set; }
        public int Value { get; set; }
    }

Because the list of years and the list of months are hierarchically and have variable lengths, the columns for these items must be generated on data load of the datagrid. The bindings are also defined in this part.

The desired behavior of the year column and the corresponding month columns is like this:
  • when the year column is visible, the month columns aren't visible
  • when doubleclicked on the header of the year column, the month columns are shown and the year column is hidden. 
  • vice versa...

I'm using this code to obtain this:

private void TestGridDataLoaded(object sender, EventArgs e)
{
    var items = (List<GridLine>)TestGrid.ItemsSource;
    if (items == null || items.Count == 0) return;
 
 
    // Generate columns for hierarchical years and months.
    for (int yearCounter = 0; yearCounter < FixedNumberOfYears; yearCounter++)
    {
        var year = items[0].Years[yearCounter];
        var yearColumn = new GridViewDataColumn
            {
                Tag = year.Code,
                DataMemberBinding = new Binding(string.Format("Years[{0}].TotalValue", yearCounter)),
            };
        yearColumn.Header = CreateColumnHeaderLabel(yearColumn, year.Code);    // creates a double clickable header to toggle visibility
 
        _gridColumns.Add(yearColumn, new List<GridViewDataColumn>());
        TestGrid.Columns.Add(yearColumn);
 
        for (var monthCounter = 0; monthCounter < FixedNumberOfMonths; monthCounter++)
        {
            var month = year.Months[monthCounter];
            var monthColumn = new GridViewDataColumn
            {
                IsVisible = false,
                Header = CreateColumnHeaderLabel(yearColumn, month.Code, true),
                DataMemberBinding = new Binding(string.Format("Years[{0}].Months[{1}].Value", yearCounter, monthCounter))
            };
 
            _gridColumns[yearColumn].Add(monthColumn);
            TestGrid.Columns.Add(monthColumn);
        }
    }
}
 
private System.Windows.Controls.Label CreateColumnHeaderLabel(GridViewDataColumn yearColumn, string content, bool isMonth = false)
{
    var label = new System.Windows.Controls.Label
    {
        Content = content,
        Tag = yearColumn, Foreground = new SolidColorBrush( isMonth ? Colors.Yellow : Colors.White)
    };
 
    label.MouseDoubleClick += ToggleColumnsVisibility;
 
    return label;
}


Now, all this works fine, except for the showing and hiding of the columns. The performance of this action is quite slow. when a dozen columns must be hidden (IsVisible=false) and a dozen hidden columns must be shown (IsVisible=true), it takes some seconds. 

Can anyone explain to me how this showing and hiding using the  IsVisible property works and if there are ways to reduce the rendering time of these actions?

I've added a screenshot of the real life project to this thread. The project is much more complex then the code samples above because it uses converters, custom celltemplates, custom celledittemplates... when creating the columns for month and year. This probably also slows down the rendering.

Best regards, 
Pieter Jan Verfaillie
Pieter Jan Verfaillie
Top achievements
Rank 1
 answered on 22 Jan 2013
1 answer
148 views
If I put this in a MEFed dll (using MefedMVVM), I receive an exception:

<UserControl ...
     mefed:ViewModelLocator.NonSharedViewModel="MyViewModel">
<telerik:RadPropertyGrid Item="{Binding IsAsync=True}" AutoGeneratePropertyDefinitions="True" />

Error while resolving ViewModel. System.ComponentModel.Composition.ImportCardinalityMismatchException: No exports were found that match the constraint

I suppose this binding somehow conflicts with my MEF contract. Any ideas? Makes no sense... but if I remove the binding, it works!
Ivan Ivanov
Telerik team
 answered on 22 Jan 2013
2 answers
112 views
Does anyone know where I can find some examples &/or resources on how to properly change colors for built-in themes?  I am trying to transition from using the Metro theme in which I had a singleton and could just access it and change the colors for the whole application.  To know I am trying to utilize the Windows8Touch theme and I no longer have access to something like: Windows8TouchColors.PaletteInstance.MainColor = Colors.Orange
Igor
Top achievements
Rank 1
 answered on 22 Jan 2013
1 answer
320 views
Hi,

I set 240 points in a RadCartesianChart, And then I changed some points' value.(Please watch pic1)
But I want to display like pic2.

Or you have a way to draw this only need a few pionts.

I need to use RadCartesianChart's behavior like this. So I can't use RadChart
<telerik:RadCartesianChart.Behaviors>
	<telerik:ChartTrackBallBehavior ShowIntersectionPoints="True" TrackInfoUpdated="ChartTrackBallBehavior_TrackInfoUpdated_1" />
</telerik:RadCartesianChart.Behaviors>

If RadCartesianChart has a property like this is better.
<telerik:RadChart>
 <telerik:RadChart.SeriesMappings>
 <telerik:SeriesMapping>
<telerik:SeriesMapping.SeriesDefinition>
<telerik:LineSeriesDefinition EmptyPointBehavior="Gap" />
</telerik:SeriesMapping.SeriesDefinition>
Sorry My English is not very well, If you can understand what I say, I would be very grateful.

Thanks.
Petar Marchev
Telerik team
 answered on 22 Jan 2013
1 answer
130 views
Hi,

When I attempt to "Edit Template" of RadColorEditor in Expression Blend, the Sliders disappear from the template. Is there an easy way to edit the style of these controls used within RadColorEditor's ControlTemplate?

Thanks,
Frankie
Petar Mladenov
Telerik team
 answered on 22 Jan 2013
1 answer
146 views
I have a Pie Chart that is bound to a stored procedure, the stored procedure brings back the percentage of sales for each sales person in my database.  As the user select  diffrent sales people I would like to be able to highlite or pull the wedge out that represents that sales person.  I have the salesperson code, but right now its not bound and I know which sales person they are looking at.

<telerik:RadPieChart HorizontalAlignment="Left" Margin="31,32,0,0" VerticalAlignment="Top">
<telerik:PieSeries x:Name="TotalSalePercent" ShowLabels="True"
ItemsSource="{Binding}"
ValueBinding="__of_Total_Sales">
</telerik:PieSeries>
</telerik:RadPieChart>


List<spSalesPercentResult> spSalesPercentresult = (from s in conn.spSalesPercent()
select s).ToList();
            TotalSalePercent.ItemsSource = spSalesPercentresult;


Evgenia
Telerik team
 answered on 22 Jan 2013
5 answers
361 views
Can someone point me to an example of changing the appearance of a RadToggleButton (hover, checked, not checked) using a ControlTemplate or otherwise (But NOT using Expression Blend)?

Thank you.
Biliana Ficheva
Telerik team
 answered on 22 Jan 2013
2 answers
57 views
I am using the RadGridView from Rad controls 2012 Q3

I see to different behaviours for selection:
-When I click on an item with the mouse, the row is highlighted (in orange) 
-When I programmatically set the selection (myGridView.SelectedItem = anObject), the row is highlighted (in grey)

I would like to be able to programmatically set the selection AND have it be highlighted (as is the case with the mouse click)

a) Why these behaviours are different?
b) How can I programmatically set the selection AND have it be highlighted?

Note: I am not trying to change the selection colors, but have programmatic selection behave the same as mouse selection.

Thank you

Mark
Top achievements
Rank 1
 answered on 21 Jan 2013
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?