Telerik Forums
UI for WPF Forum
3 answers
286 views

Hello everybody,
I am using  RadControls for WPF Q3 2009 SP2, and the version of the Telerik.Windows.Controls.GridView.dll is 2009.3.1314.35

In a gridview I had to insert a button with an image using the following XAML code;

<telerik:RadGridView x:Name="radGridInvoiceDetails" ShowGroupPanel="False" AutoGenerateColumns="False" Height="280" Width="920" HorizontalAlignment="Left" ScrollMode="RealTime" ItemsSource="" >
    <telerik:RadGridView.Columns> 
        <telerik:GridViewDataColumn Header="ProductType" DataMemberBinding="{Binding ProductTypeDescription}" IsReadOnly="True" IsFilterable="False" HeaderTextAlignment="Center" Width="Auto" IsVisible="False"/>
        <telerik:GridViewDataColumn Header="Prodotto" DataMemberBinding="{Binding ProductDescription}" IsReadOnly="True" IsFilterable="False" HeaderTextAlignment="Center" Width="Auto" IsVisible="False"/>
        <telerik:GridViewDataColumn Header="Numero" DataMemberBinding="{Binding BillNumberString}" IsReadOnly="True" IsFilterable="False" HeaderTextAlignment="Center" Width="Auto" TextAlignment="Right"/>
        <telerik:GridViewDataColumn Header="Data" DataMemberBinding="{Binding BillDate}" IsReadOnly="True" IsFilterable="False" HeaderTextAlignment="Center" Width="Auto" DataFormatString="{}{0:dd/MM/yyyy}"/>
        <telerik:GridViewDataColumn Header="Qta" DataMemberBinding="{Binding ProductQuantity}" IsReadOnly="True" IsFilterable="False" HeaderTextAlignment="Center" Width="Auto" DataFormatString="{}{0:N2}" TextAlignment="Right"/>
        <telerik:GridViewDataColumn Header="Prz.Uni" DataMemberBinding="{Binding ProductFee}" IsReadOnly="True" IsFilterable="False" HeaderTextAlignment="Center" Width="Auto" DataFormatString="{}{0:N2}" TextAlignment="Right"/>
        <telerik:GridViewDataColumn Header="Tot.Prod" DataMemberBinding="{Binding ProductTotal}" IsReadOnly="True" IsFilterable="False" HeaderTextAlignment="Center" Width="Auto" DataFormatString="{}{0:N2}" TextAlignment="Right"/>
        <telerik:GridViewDataColumn Header="Scontato" DataMemberBinding="{Binding ProductDiscountedTotal}" IsReadOnly="True" IsFilterable="False" HeaderTextAlignment="Center" Width="Auto" DataFormatString="{}{0:N2}" TextAlignment="Right"/>
        <telerik:GridViewDataColumn Header="Trasporto" DataMemberBinding="{Binding TransportTotal}" IsReadOnly="True" IsFilterable="False" HeaderTextAlignment="Center" Width="Auto" DataFormatString="{}{0:N2}" TextAlignment="Right"/>
        <telerik:GridViewDataColumn Header="Scontato" DataMemberBinding="{Binding TransportDiscountedTotal}" IsReadOnly="True" IsFilterable="False" HeaderTextAlignment="Center" Width="Auto" DataFormatString="{}{0:N2}" TextAlignment="Right"/>
        <telerik:GridViewDataColumn Header="Sconto totale" DataMemberBinding="{Binding TotalDiscountAmount}" IsReadOnly="True" IsFilterable="False" HeaderTextAlignment="Center" Width="Auto" DataFormatString="{}{0:N2}" TextAlignment="Right"/>
        <telerik:GridViewDataColumn Header="Imponibile" DataMemberBinding="{Binding TotalBill}" IsReadOnly="True" IsFilterable="False" HeaderTextAlignment="Center" Width="Auto" DataFormatString="{}{0:N2}" TextAlignment="Right"/>
        <telerik:GridViewDataColumn Header="IVA" DataMemberBinding="{Binding VATString}" IsReadOnly="True" IsFilterable="False" HeaderTextAlignment="Center" Width="Auto" TextAlignment="Right"/>
        <telerik:GridViewDataColumn Header="Totale" DataMemberBinding="{Binding TotalVAT}" IsReadOnly="True" IsFilterable="False" HeaderTextAlignment="Center" Width="Auto" DataFormatString="{}{0:N2}" TextAlignment="Right"/>
        <telerik:GridViewDataColumn x:Name="columnView" IsFilterable="False" IsSortable="False" Width="40">
            <telerik:GridViewColumn.CellTemplate>
                <DataTemplate>
                    <Button x:Name="buttonView" Click="buttonView_Click" Background="White" BorderBrush="White">
                        <Image Height="20" Width="20" Source="/Raise.FarinaEzio.SIB.Client.Management.GUI.BusinessManagement.Controls;component/Images/Edit.png" />
                        <Button.ToolTip>
                            <StackPanel Orientation="Horizontal">
                               <Image Source="/Raise.FarinaEzio.SIB.Client.Management.GUI.BusinessManagement.Controls;component/Images/Edit.png" />  
                              <Label Content="Visualizza la bolla"/>
                          </StackPanel>
                       </Button.ToolTip>
                   </Button>
                </DataTemplate>
            </telerik:GridViewColumn.CellTemplate>
        </telerik:GridViewDataColumn>
    </telerik:RadGridView.Columns>
</telerik:RadGridView>

In the code behind I had to add some group and some sum functions using code like the following

GroupDescriptor descriptor = new Telerik.Windows.Data.GroupDescriptor();
 
descriptor.Member = "ProductTypeDescription";
descriptor.SortDirection = ListSortDirection.Ascending;
radGridInvoiceDetails.GroupDescriptors.Add(descriptor);
descriptor = new Telerik.Windows.Data.GroupDescriptor(); 
descriptor.Member = "ProductDescription";
descriptor.SortDirection = ListSortDirection.Ascending;
var sumFunction = new Telerik.Windows.Data.SumFunction();
sumFunction.ResultFormatString = "{0:N2}";
sumFunction.SourceField = "ProductQuantity";
sumFunction.Caption = "Totale Quantit";
descriptor.AggregateFunctions.Add(sumFunction);
sumFunction = new Telerik.Windows.Data.SumFunction();
sumFunction.ResultFormatString = "{0:N2}";
sumFunction.SourceField = "TotalBill";
sumFunction.Caption = "Totale Imponibile";
descriptor.AggregateFunctions.Add(sumFunction);
sumFunction = new Telerik.Windows.Data.SumFunction();
sumFunction.ResultFormatString = "{0:N2}";
sumFunction.SourceField = "TotalVAT";
sumFunction.Caption = "Totale Con IVA";
descriptor.AggregateFunctions.Add(sumFunction);
radGridInvoiceDetails.GroupDescriptors.Add(descriptor);

Every grouping and sum functions work perfectly.
My problem is the button inserted in datatemplate.
The first time the grid is filled up all the buttons are clickable and when they are clicked evrything works very fine.
Starting from the second time none of the buttons are clickable anymore. The look and feel of the problem is that after the click the button is shown as selected but the typical "click behaviour" of the button disappeares and no Click event is trapped.
Insisting to the click of the button the image disappears and you see a small text box that takes the focus.
I have already used buttons inserted into a datatemplate but I have never seen this strange behaviour.
The first thought I've had is that the problem may be due to the groups I have add, that's because in the other grids no groups were added.

Thank you very much in advance for you help.

Nick

Vlad
Telerik team
 answered on 03 Feb 2010
5 answers
544 views

My problem is that I am wanting to use 1 data template for multiple colums in a gridview, but I want to bind the element in the data template to a different path.

In the example below I have a template that creates a checkbox.

<Grid.Resources> 
            <Style x:Key="CheckboxCellStyle" TargetType="{x:Type telerik:GridViewCell}">  
                <Setter Property="ContentTemplate">  
                    <Setter.Value> 
                        <DataTemplate> 
                            <CheckBox VerticalAlignment="Center" IsChecked="{Binding ????}" Click="CheckBox_Click" /> 
                        </DataTemplate> 
                    </Setter.Value> 
                </Setter> 
            </Style> 
</Grid.Resources> 

I want to bind the IsChecked property to the binded element in the data colulmn definition.

<telerik:GridViewDataColumn Header="Deleted" DataMemberBinding="{Binding Deleted}" CellStyle="{StaticResource CheckboxCellStyle}"></telerik:GridViewDataColumn> 
<telerik:GridViewDataColumn Header="Selected" DataMemberBinding="{Binding Selected}" CellStyle="{StaticResource CheckboxCellStyle}"></telerik:GridViewDataColumn> 


Can someone please help me find a solution to this problem?
Pavel Pavlov
Telerik team
 answered on 03 Feb 2010
1 answer
72 views

Hi all,

I'm trying to do the following:

http://www.telerik.com/help/wpf/radchart-styling-and-appearance-styling-item-labels.html

First time that I load the RadChart works... but if I want to reload the RadChart the style is the previous, without changes.

The curious thing is my axis custom style remains changed every time.

Any code sample to solve this problem? What is the reason for this behavor?

Regards,

Gerard
Dwight
Telerik team
 answered on 03 Feb 2010
1 answer
178 views

Hello.
I am trying to make the Element field below 'FullName' be a dynamic value that reads from
{
Binding Path=Name}.
Something like this
<TextBox Text="{Binding Path=Element[{Binding Path=Name}].Value}" Margin="2"></TextBox>
but it doesnt work.

 

<UserControl.Resources> 
        <HierarchicalDataTemplate   
                       ItemsSource="{Binding Path=Elements}"   
            x:Key="TVTemplate">  
            <telerik:RadTreeView> 
                <WrapPanel> 
                    <TextBlock Text="{Binding  Path=Name}" Margin="2"></TextBlock> 
                        <TextBox Text="{Binding  Path=Element[FullName].Value}" Margin="2"></TextBox> 
                    </WrapPanel></telerik:RadTreeView> 
        </HierarchicalDataTemplate> 
    </UserControl.Resources> 

 

TheLostLeaf
Top achievements
Rank 2
 answered on 02 Feb 2010
5 answers
332 views
I have a "search" box that allows a user to filter the tree based on the underlying entity lable name using a filter on the collectionview. This works great except that it collapses all the tree nodes and doesn't maintain their expanded state. Is there a way to filter and maintian tree node state?
Valentin.Stoychev
Telerik team
 answered on 02 Feb 2010
2 answers
127 views
Hello,
     There was a function called hittest that I used in another grid that I worked with that allowed me to determine if a cell had been clicked on or a column or row header had been clicked on. Does this grid have such a function?
Thanks 
Jorge Gonzalez
Top achievements
Rank 1
 answered on 02 Feb 2010
8 answers
353 views
Hi,

telerik: 2009.3.1322.35
.net 4.0 beta 2

When I follow the steps below I get an error:
1. Set a filter on gridviewdatacolumn
2. Filtered items set contains a certain dataitem
3. Change this dataitem such that it no longer belongs to filtered items
4.  After the change I scroll into view:
GridView.SelectedItem = _dataItem 
                If GridView.SelectedItem IsNot Nothing Then 
                    GridView.ScrollIntoView(GridView.SelectedItem) 
                End If 

Now I get the following error:



   at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.BringIndexIntoView(Int32 index) in c:\Builds\WPF_Scrum\GridView_WPF_2009_Q3_SP1\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\GridViewVirtualizingPanel.BringIntoView.cs:line 29
   at Telerik.Windows.Controls.GridView.GridViewDataControl.ScrollIntoViewRecursive(FrameworkElement element, Stack`1 itemStack, Action`1 scrollFinishedCallback) in c:\Builds\WPF_Scrum\GridView_WPF_2009_Q3_SP1\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.Scrolling.cs:line 252
   at Telerik.Windows.Controls.GridView.GridViewDataControl.ScrollRowIntoViewInternal(Object dataItem, Action`1 scrollFinishedCallback) in c:\Builds\WPF_Scrum\GridView_WPF_2009_Q3_SP1\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.Scrolling.cs:line 191
   at Telerik.Windows.Controls.GridView.GridViewDataControl.<>c__DisplayClass69.<ScrollIntoViewAsync>b__68() in c:\Builds\WPF_Scrum\GridView_WPF_2009_Q3_SP1\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.Scrolling.cs:line 94
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)


Thomas
Top achievements
Rank 1
 answered on 02 Feb 2010
2 answers
103 views

Hi,

I have no problems binding my classes to the GridView. But when I attempt to bind a linq filtered DataSet table

IEnumerable<DB.MyDataSet.XXXRow> filter = dataset.XXX.Take(10);

GridView.ItemsSource = filter;

all I see in GridView is rows with no text in them, when I enter edit mode in a row, the missing text is suddenly right there. It goes invisible again when edit mode is canceled.

This is how I setup the header:

Telerik.Windows.Controls.GridViewDataColumn columnName = new Telerik.Windows.Controls.GridViewDataColumn();         


columnName.DataType = typeof(string);

columnName.UniqueName = "YYY";

columnName.Header = "sweet YYY"

any ideas what is going on?

Thanks

Jiri

Lukas
Top achievements
Rank 1
 answered on 02 Feb 2010
3 answers
84 views
Hello,

I created a stacked bar chart with 4 data series. When I display the chart I sometimes get floating bars, I disabled two of the data series (since they rarely have data) and the one series still has a floating stacked bar. I attached a screenshot to make the situation more clear. I am not sure why my bars are floating. Note that I also have other bar charts that are created the exact same way but they never have a floating data series.
Velin
Telerik team
 answered on 02 Feb 2010
3 answers
43 views
Hello,
    I execute a proc and load its contents into a dataset, which I than associate with the grid. That works fine.
If I than repeat this process in order to update the grid's contents the changes do not show up on the grid unless I close the app and open it up again.
To get around this problem I execute this command (gridname.itemssource = null) to break the association between the grid and the dataset. I than run the proc again , load the dataset , and than associate the grid with the dataset again. This works.

Is this what I am suppose to do?
Vlad
Telerik team
 answered on 02 Feb 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?