Telerik Forums
UI for WPF Forum
1 answer
114 views
Greetings.

The code below (see partial XAML and C#) display the grid of "Prospects".
Prospect's First, Last, and Middle name are GridViewDynamicHyperlinkColumn. User can click on one of those three columns and be redirected to the Prospect's edit form.
All this works perfectly until user decides to sort the grid (no matter which column).
After the grid has been sorted, clicking on First, Last, or Middle name has NO EFFECT.

Am I missing something?
If there is anything wrong, I certainly can't see it anymore.
Please help.

Thank you,

Frank M.

 

private void OnProspectGridUnLoaded(object sender, Telerik.Windows.Controls.GridView.RowUnloadedEventArgs e) {
    var row = e.Row as GridViewRow;
    if (row != null) {
        ((HyperlinkButton)row.Cells[0].Content).RemoveHandler(FrameworkElement.MouseLeftButtonDownEvent, new MouseButtonEventHandler(OnProspectLinkClicked));
        ((HyperlinkButton)row.Cells[1].Content).RemoveHandler(FrameworkElement.MouseLeftButtonDownEvent, new MouseButtonEventHandler(OnProspectLinkClicked));
        ((HyperlinkButton)row.Cells[2].Content).RemoveHandler(FrameworkElement.MouseLeftButtonDownEvent, new MouseButtonEventHandler(OnProspectLinkClicked));
    }
}
 
private void OnProspectGridLoaded(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e) {
    var row = e.Row as GridViewRow;
    if (row != null) {
        ((HyperlinkButton)row.Cells[0].Content).AddHandler(FrameworkElement.MouseLeftButtonDownEvent, new MouseButtonEventHandler(OnProspectLinkClicked), true);
        ((HyperlinkButton)row.Cells[1].Content).AddHandler(FrameworkElement.MouseLeftButtonDownEvent, new MouseButtonEventHandler(OnProspectLinkClicked), true);
        ((HyperlinkButton)row.Cells[2].Content).AddHandler(FrameworkElement.MouseLeftButtonDownEvent, new MouseButtonEventHandler(OnProspectLinkClicked), true);
    }
}
 
 
private void OnProspectLinkClicked(object sender, MouseButtonEventArgs e) {
    try {
        Type type = e.Source.GetType();
        if (type == typeof(System.Windows.Controls.ContentPresenter)) {
            DataRowView rowView = (DataRowView)((Telerik.Windows.Controls.GridView.GridViewCell)((((Telerik.Windows.Controls.GridView.HyperlinkButton)(sender)).Parent))).ParentRow.Item;
            DataRow selectedRow = (DataRow)rowView.Row;
            if (selectedRow != null && selectedRow[0] != DBNull.Value) {
                ProspectInformation.ProspectId = Convert.ToString(selectedRow["ProspectGuid"]);
                if (ProspectInformation.ProspectId != null && ProspectInformation.ProspectId != string.Empty) {
                    ((POWERPitch.Base.TabPanel)(((TabControl)parent).Parent)).IsFromHomePage = true;
                    ((POWERPitch.Base.TabPanel)(((TabControl)parent).Parent)).LinkName = Contexts.QuickLinkNames.OPEN_PROSPECT;
                    ((TabControl)parent).SelectedIndex = 2;
                }
            }
        }
    } catch (Exception ex) {
        IPMessageBox.ShowExceptionMessage("Exception in HomeForAgents.OnProspectLinkClicked " + ex.Message);
    }
}

 

<telerik:RadBusyIndicator DisplayAfter="0" x:Name="radBusyIndicator" Background="Transparent"
    HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" >
 
 <telerik:RadGridView Name="searchResultsGridView" EnableRowVirtualization="True" CanUserSortColumns="True"
    ColumnWidth="*" CanUserDeleteRows="False" IsReadOnly="True" IsFilteringAllowed="False" CanUserInsertRows="False"
    VerticalAlignment="Top" RowLoaded="OnSearchResultsGridLoaded" SelectionChanged="OnSearchResultsSelectionChanged"
    RowUnloaded="OnSearchResultsGridUnLoaded" Height="Auto" Width="Auto" Margin="5,3,5,0" Style="{StaticResource
    GridViewStyle}" HeaderRowStyle="{StaticResource HeaderStyle}" >
 
 <telerik:RadGridView.Columns>
 
     <telerik:GridViewDataColumn Name="createDateCol" Header="Last Updated" Width="Auto" DataMemberBinding="{Binding
        CreatedDate}" HeaderCellStyle="{StaticResource ColumnHeaderStyle}" CellStyle="{StaticResource
        gridcellStyle}"/>
 
     <telerik:GridViewDynamicHyperlinkColumn Name="lastNameCol" Header="Last Name" Width="Auto"
         DataMemberBinding="{Binding LastName}" HeaderCellStyle="{StaticResource ColumnHeaderStyle}"
        CellStyle="{StaticResource gridcellStyle}"/>
 
     <telerik:GridViewDynamicHyperlinkColumn Name="firstNameCol" Header="First Name" Width="Auto"
        DataMemberBinding="{Binding FirstName}" HeaderCellStyle="{StaticResource ColumnHeaderStyle}"
        CellStyle="{StaticResource gridcellStyle}"/>
 
     <telerik:GridViewDataColumn Name="dateOfBrthCol" Header="Age" Width="Auto" DataMemberBinding="{Binding DOB}"
        HeaderTextAlignment="Center" TextAlignment="Center" HeaderCellStyle="{StaticResource ColumnHeaderStyle}"
        CellStyle="{StaticResource gridcellStyle}"/>
 
     <telerik:GridViewDataColumn Name="genderCol" Header="G" Width="Auto" DataMemberBinding="{Binding Gender}"
        HeaderCellStyle="{StaticResource ColumnHeaderStyle}" CellStyle="{StaticResource gridcellStyle}"/>
 
     <telerik:GridViewDataColumn Name="stateCol" Header="ST" Width="Auto" DataMemberBinding="{Binding StateCode}"
        HeaderCellStyle="{StaticResource ColumnHeaderStyle}" CellStyle="{StaticResource gridcellStyle}"/>
 
     <telerik:GridViewDataColumn Name="quoteIdCol" Header="Quote/Illustration" Width="Auto"
        HeaderTextAlignment="Left"     TextAlignment="Left" DataMemberBinding="{Binding QuoteId}"
         HeaderCellStyle="{StaticResource ColumnHeaderStyle}" CellStyle="{StaticResource gridcellStyle}"/>
 
     <telerik:GridViewDynamicHyperlinkColumn Name="prodDescCol" Header="Product Summary" UniqueName="prodDescCol"
         DataMemberBinding="{Binding ProductDesc}" HeaderCellStyle="{StaticResource ColumnHeaderStyle}"
        CellStyle="{StaticResource gridcellStyle}"/>
 
     <telerik:GridViewDataColumn Name="annPremCol" Header="Annual Premium" Width="Auto" DataMemberBinding="{Binding
        AnnualPremium}" HeaderTextAlignment="Right" TextAlignment="Right" HeaderCellStyle="{StaticResource
        ColumnHeaderStyle}" CellStyle="{StaticResource gridcellStyle}"/>
 
     <telerik:GridViewDataColumn Name="agntCdCol" Header="Agent Code" Width="Auto" DataMemberBinding="{Binding
        AgentCode}" HeaderTextAlignment="Right" TextAlignment="Right" HeaderCellStyle="{StaticResource
        ColumnHeaderStyle}" CellStyle="{StaticResource gridcellStyle}"/>
 
     <telerik:GridViewDataColumn Name="agntNameCol" Header="Agent Name" Width="Auto" DataMemberBinding="{Binding
        AgentName}" HeaderCellStyle="{StaticResource ColumnHeaderStyle}" CellStyle="{StaticResource gridcellStyle}"/>
 
     <telerik:GridViewDataColumn Name="gaCodeCol" Header="GA Code" Width="Auto" DataMemberBinding="{Binding GACode}"
         HeaderTextAlignment="Right" TextAlignment="Right" HeaderCellStyle="{StaticResource ColumnHeaderStyle}"
        CellStyle="{StaticResource gridcellStyle}"/>
 
     </telerik:RadGridView.Columns>
 
   </telerik:RadGridView>
 
 </telerik:RadBusyIndicator>
Dimitrina
Telerik team
 answered on 03 Sep 2013
1 answer
137 views
Dear Telerik Support Team!

I am so beginner with C# and WPF technologic. My managers liked the telerik's options what they could saw with your demos.
I have to use Oracle 11g database server, therefore I maked a sample OLAP database and sample cubes.
I have a hostname(192.168.81.112), a port(1521), and a SID(orcl), and a username, and password to identify that oracle database connection. I found some sample what you have done (RadPivotGrid-XmlaDataProvider-SimpleApp-SL) it looks like those maked to microsoft databases.
The cube name is SALES_CUBE and the used dimensions are: CHANNEL, TIME, GEOGRAPHY, PRODUCT.
Do you have any sample code how could i use any provider to oracle olap cube?

Thank you in anticipation,
Best regards,

Ed
Rosen Vladimirov
Telerik team
 answered on 03 Sep 2013
1 answer
73 views
Hi,

Could you please show how to create a dark windows8 touch theme?
Also how to use the colors of the theme in other parts of my app?

Thank you
Rosen Vladimirov
Telerik team
 answered on 03 Sep 2013
9 answers
309 views
Hi

RadTreeListView is taking time to display the records when the volume of records being added at very shot intervals are high
The same piece of code works absolutely find in RadGridView just replacing the RadTreeListView to RadGridView in xaml

To explain further, If I have 20k records in RadTreeListView and add 10 records at a time three times in a very quick succession (few milliseconds gap), the UI freezes for a few milliseconds and displays 30 records at one go where as the same piece of code works fine in RadGridView as I can see 10 records each coming in to the Grid.

Unfortunately I cannot post the sourcecode as it is bit complex but would like to know if I am missing anything? It could be just a property or something else or is it the behavior of RadTreeListView?

I have one level of hierarchy in RadTreeListView and it is the same behavior even if the hierarchy do not contain any data

The reason I am using RadTreeListView is basically it aligns the columns in the hierarchy with parent records which is missing in RadGridView

Any information is much appreciated.
Yordanka
Telerik team
 answered on 03 Sep 2013
5 answers
151 views
Hello,

I'm getting this error if i try to input "9999/12/31 24:00".
System.ArgumentOutOfRangeException: The added or subtracted value results in an un-representable DateTime.
Parameter name: value

This doesn't happen the first time. The first time, it just changes to 12:00 which is okay. On re-input, I get the above error. Somehow the control throws this error and I can't catch this even in the viewModel.
Rosen Vladimirov
Telerik team
 answered on 03 Sep 2013
1 answer
176 views
You have IsSnapToItemsEnabled and IsSnapToGridEnabled. Neither of these snaps to connectors (custom-positioned connectors). I believe snapping is pretty useless if you cannot snap in such way that connections are perpendicular lines.

E.g. This is what it looks like when snapping is enabled. No matter what, the line between the connectors will be non-perpendicular.

[------------------C------------------]
                        \
      [--------------C--------------]

Moving to the left snaps to a new grid line:

[------------------C------------------]
                       /
    [--------------C--------------]

What I want is this:

[------------------C------------------]
                       |
    [--------------C--------------]


Can you please add such a feature? You have to agree that it makes sense to have this. Thanks.
Pavel R. Pavlov
Telerik team
 answered on 03 Sep 2013
1 answer
194 views
I have custom classes and custom styles for RadDiagram, RadDiagramShape, RadDiagramConnection, RadDiagramConnector. Now I have run into a styling issue that requires pro help from you :)

I want my connectors to show their label when either of these two conditions is met:
1) The connector's shape (or any of its children) is hovered by the mouse.
2) Any connection, from any shape, is being dragged.

I started off adding a TextBlock to my connector style, but it seems I cannot properly toggle its visibility. If I set it to "Collapsed", it is never shown. Maybe this approach is all wrong, but still, here it is:

<Style TargetType="chart:MyChartConnector" x:Key="MyChartConnectorStyle" BasedOn="{StaticResource RadDiagramConnectorStyle}">
    <Setter Property="FocusVisualStyle" Value="{x:Null}" />
    <!-- Auto seems reasonable? -->
    <Setter Property="Width" Value="Auto" />
    <Setter Property="Height" Value="Auto" />
 
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="chart:MyChartConnector">
                <Grid>
                    <VisualStateManager.VisualStateGroups>
                        <VisualStateGroup x:Name="MouseStates">
                            <VisualState x:Name="Normal" />
                            <VisualState x:Name="MouseOver">
                                <Storyboard>
                                    <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="DisplayElement"
                                            Storyboard.TargetProperty="Visibility">
                                        <DiscreteObjectKeyFrame KeyTime="0">
                                            <DiscreteObjectKeyFrame.Value>
                                                <Visibility>Collapsed</Visibility>
                                            </DiscreteObjectKeyFrame.Value>
                                        </DiscreteObjectKeyFrame>
                                    </ObjectAnimationUsingKeyFrames>
                                </Storyboard>
                            </VisualState>
                        </VisualStateGroup>
                        <VisualStateGroup x:Name="ActiveStates">
                            <VisualState x:Name="Inactive" />
                            <VisualState x:Name="Active">
                                <Storyboard>
                                    <ObjectAnimationUsingKeyFrames Duration="0"
                                            Storyboard.TargetName="DisplayElement"
                                            Storyboard.TargetProperty="Visibility">
                                        <DiscreteObjectKeyFrame KeyTime="0">
                                            <DiscreteObjectKeyFrame.Value>
                                                <Visibility>Collapsed</Visibility>
                                            </DiscreteObjectKeyFrame.Value>
                                        </DiscreteObjectKeyFrame>
                                    </ObjectAnimationUsingKeyFrames>
                                </Storyboard>
                            </VisualState>
                        </VisualStateGroup>
                    </VisualStateManager.VisualStateGroups>
                    <Grid>
                        <Ellipse x:Name="OverElement"
                                 Width="20"
                                 Height="20"
                                 Fill="{TemplateBinding Background}"
                                 StrokeThickness="{TemplateBinding BorderThickness}"
                                 Stroke="{TemplateBinding BorderBrush}" />
                        <Ellipse x:Name="DisplayElement"
                                 Width="20"
                                 Height="20"
                                 Fill="#40000000"
                                 StrokeThickness="{TemplateBinding BorderThickness}"
                                 Stroke="{TemplateBinding BorderBrush}" />
 
                        <!-- This does not work as intented :( -->
                        <TextBlock Text="{TemplateBinding DisplayName}" Visibility="Collapsed">
                            <TextBlock.Style>
                                <Style TargetType="TextBlock">
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type chart:MyChartShape}}, Path=IsMouseOver}" Value="True" >
                                            <Setter Property="Visibility" Value="Visible" />
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </TextBlock.Style>
                        </TextBlock>
                    </Grid>
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
Hristo
Telerik team
 answered on 03 Sep 2013
2 answers
101 views
Hello,

I have a radchart and personalized chartlegend. In my chartlegend I have a checkbox and I need to get the color that has given radchart sets. But when I try to know the color, in "aparrence" fields appear all to null, but really if you are painting with a certain color.

<telerik:RadChart x:Name="RadChart1"
                  Grid.Row="1"
                  Grid.Column="1"
                  UseDefaultLayout="False">
    <telerik:RadChart.SamplingSettings>
        <telerik:SamplingSettings SamplingFunction="Average" />
    </telerik:RadChart.SamplingSettings>
 
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="10" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="10" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="10" />
            <RowDefinition Height="*" />
            <RowDefinition Height="100" />
            <RowDefinition Height="10" />
        </Grid.RowDefinitions>
        <Grid />
        <telerik:ChartLegend x:Name="legendChart"
                             Grid.Row="2"
                             Grid.Column="1"
                             Header=""
                             ItemContainerStyle="{DynamicResource CharLegendStyle}"
                             ItemsPanelOrientation="Horizontal"
                             LegendItemMarkerShape="Circle"
                             UseAutoGeneratedItems="false" />
 
        <telerik:ChartArea x:Name="lineGraphChartArea"
                           Grid.Row="1"
                           Grid.Column="1"
                           HorizontalAlignment="Stretch"
                           VerticalAlignment="Stretch"
                           EnableAnimations="False"
                           LegendName="legendChart">
            <telerik:ChartArea.AxisX>
                <telerik:AxisX Title="Fecha"
                               AutoRange="True"
                               IsDateTime="True"
                               Step="1" />
            </telerik:ChartArea.AxisX>
            <telerik:ChartArea.AxisY>
                <telerik:AxisY Title="CMN"
                               AutoRange="True"
                               ExtendDirection="Up"
                               IsZeroBased="True" />
            </telerik:ChartArea.AxisY>
 
 
        </telerik:ChartArea>
 
    </Grid>
 
 
</telerik:RadChart>


public SeriesMapping GenerateRandomSeries(string nameSerie,int begin)
        {
            SeriesMapping serie1 = new SeriesMapping();
            serie1.ItemsSource = GenerateRandomData(begin);
            serie1.ChartAreaName = "lineGraphChartArea";
            serie1.LegendLabel = nameSerie;
            ItemMapping X = new ItemMapping("Fecha", DataPointMember.XValue);
            ItemMapping Y = new ItemMapping("CMN", DataPointMember.YValue);
            serie1.ItemMappings.Add(X);
            serie1.ItemMappings.Add(Y);
 
            serie1.SeriesDefinition = new SplineSeriesDefinition()
                {
                    
                };
            
             
 
            return serie1;
 
        }
 
public void AddSerieDefinition()
        {
 
 
            RadChart1.SeriesMappings.Add(GenerateRandomSeries("serie1",5));
            RadChart1.SeriesMappings.Add(GenerateRandomSeries("serie2",10));
            RadChart1.SeriesMappings.Add(GenerateRandomSeries("serie3",15));
        }


I try get color and (look attached)


Thank you!
david
Top achievements
Rank 1
 answered on 03 Sep 2013
1 answer
166 views
I am trying to bind a contextual group to the IsActive property using a custom property of a UserControl. The contextual tab should only be shown after the user has selected a port from a dropdown list. I have tried each of the following with no success, but hopefully it gives you an idea of what I'm trying to do.

<telerik:RadRibbonView.ContextualGroups>
<telerik:RadRibbonContextualGroup x:Name=
"xCOM" IsActive="{Binding RelativeSource={RelativeSource Self}, Path=IsPortSelected}"/>
<telerik:RadRibbonContextualGroup x:Name=
"xCOM" IsActive="{Binding ElementName=_this, Path=IsPortSelected}"/>
<telerik:RadRibbonContextualGroup x:Name=
"xCOM" IsActive="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MyRibbon}}, Path=IsPortSelected}"/>
<telerik:RadRibbonContextualGroup x:Name=
"xCOM" IsActive="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=IsPortSelected}"/>
</telerik:RadRibbonView.ContextualGroups>

Where IsPortSelected is the property in MyRibbon:

string _port = "";
public string Port
{
    get { return _port; }
    set
    {
        if (_port == value)
        {
            return;
        }
        _port = value;
    }
}
 
public bool IsPortSelected
{
    get
    {
        if (String.IsNullOrEmpty(_port))
        {
            return false;
        } else if (_port.Equals("Port")) {
            return false;
        }
        return true;
    }
    set { }
}

Is there something wrong with my binding statement? Or do I need to do something else in the code behind, such as implementing a PropertyChangedEventHandler (which I have tried with no success as well)?
Pavel R. Pavlov
Telerik team
 answered on 03 Sep 2013
1 answer
74 views
Hello,

I got a RadGridView Inside a RadWindow, I'm trying to paste in this RadGridview some data copied from Excel, it works fine if i click over the left top corner of the Radgridview, but if i open the RadWindow and attempt to paste right away, it just doesnt work, the paste event doesnt get fired. the globlal functionality is:


1. Press some button and open the RadWindow with my empty RadGridView Inside
2. Without clicking anywhere,  Press Ctrl + V and paste inside the RadGridView all the data that i have in the clipboard
3. that's it

I tried to set the focus to the RadGridView, but it doesnt seems to work.

Thanks.

Maya
Telerik team
 answered on 03 Sep 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?