Telerik Forums
UI for WPF Forum
1 answer
198 views

Hello,
I am developing a WPF application that uses Microsoft.SqlServerCe.Client.3.5. and LINQ

I use a grid view to show data and its XAML code looks like the following


<telerik:RadGridView x:Name="unsavedFormsGridView"

 Height="300"

 AutoGenerateColumns="False"

 ShowGroupPanel="False"

 MultipleSelect="False"

 ColumnsWidthMode="Fill">

<telerik:RadGridView.Columns>

<telerik:GridViewDataColumn Header="Targa"

HeaderTextAlignment="Center"

Width="70"

IsReadOnly="True"
IsFilterable="False"

IsSortable="False"

DataMemberBinding="{Binding LandfillVehiclePlate}"/>

<telerik:GridViewDataColumn Header="N° formulario"
HeaderTextAlignment="Center"

Width="110"

IsReadOnly="True"

IsFilterable="False"

IsSortable="False"

DataMemberBinding="{Binding PrintedFormCode}"/>

<telerik:GridViewDataColumn x:Name="columnSave"
IsFilterable
="False"

IsSortable="False">

<telerik:GridViewColumn.CellTemplate>

<DataTemplate>

<Button x:Name="buttonSave" Click="buttonSave_Click">

<Image Source="/Images/CheckMark.png" Height="20" Width="20" />

<Button.ToolTip>

<StackPanel Orientation="Horizontal">

<Image Source="/Images/CheckMark.png" Height="20" Width="20" />

<Label Content="Salva in modo definitivo il formulario"/>

</StackPanel>

</Button.ToolTip>

</Button>

</DataTemplate>

</telerik:GridViewColumn.CellTemplate>

</telerik:GridViewDataColumn>

<telerik:GridViewDataColumn x:Name="columnDelete" IsFilterable="False" IsSortable="False" >

<telerik:GridViewColumn.CellTemplate>

<DataTemplate>

<Button x:Name="buttonCancel" Click="buttonCancel_Click">

<Image Source="/Images/Cancel.png" Height="20" Width="20" />

<Button.ToolTip>

<StackPanel Orientation="Horizontal">

<Image Source="/Images/Cancel.png" Height="20" Width="20" />

<Label Content="Elimina in modo definitivo il formulario"/>

</StackPanel>

</Button.ToolTip>

</Button>

</DataTemplate>

</telerik:GridViewColumn.CellTemplate>

</telerik:GridViewDataColumn>

</telerik:RadGridView.Columns>

</telerik:RadGridView>

 

To bind data to the GridView I use an observable collection of a  LINQ  table get from the data context created on my SDF file.


ObservableCollection<MyTable> tempOperations = new ObservableCollection<MyTable>();


To initialize the GridView at program start I use this code


unsavedFormsGridView.ItemsSource = null;

tempOperations.Clear();

var temporaryOperations = from lto in dc.MyTable select lto;

foreach (MyTable item in temporaryOperations)

{

    tempOperations.Add(item);

}

unsavedFormsGridView.ItemsSource = tempOperations;

 

Everything works fine and I can appreciate all data from the file into the GridView.

Very strange is the thing that happens lately, during a save process in which I write a new record that user input.
This process is started by a Button, different from those included in the gridview.

I create a new record and add it into the observable collection tempOperations in a code like this


private void buttonSaveTemporarly_Click(object sender, RoutedEventArgs e)

{

 

  //Create the new record into currentOperation

  BuildCurrentOperation();

 

  dc.LandfillTempOperations.InsertOnSubmit(currentOperation);

  dc.SubmitChanges();

 

  unsavedFormsGridView.ItemsSource = null;

  tempOperations.Add(currentOperation);

  unsavedFormsGridView.ItemsSource = tempOperations;

 

  //Set all the input controls to blank for the next new record

  TempInitForm();

}

 

When the function terminates his job, the application does not respond to any input and more or less after 60 seconds appears the message


ContextSwitchDeadlock was detected
The CLR has been unable to transition from COM context 0x1fe3b0 to COM context 0x1fe520 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations


I must say that trying to understand more about this I have executed the application step by step.
At the end of the function VisualStudio 2008 asks to show a disassembly and in the address combobox of the disassembly window appears the following address

Telerik.Windows.Controls.GridView.BaseVirtualizingPanel.MeasureOverride(System.Windows.Size).

At this point my suspect is that there is something illegal I do in using GridView.

May anyone help me?

Thank you in advance

Nick


Rossen Hristov
Telerik team
 answered on 03 Sep 2009
12 answers
138 views
Hi Folks,

When I assigned values to AxisX.Title and AxisY.Title, these values do not get displayed when I run the program.   Here is a sample of my XAML code, GDF and OPTIME does not get displayed:

<

 

telerik:RadChart Width="299" Height="299" ItemsSource="{Binding Path=ConditionIndicatorDataPoints}">

 

 

 

 

    <telerik:RadChart.DefaultView>

 

 

 

 

            <telerik:ChartDefaultView>

 

 

 

 

                    <telerik:ChartDefaultView.ChartTitle>

 

 

 

 

                            <telerik:ChartTitle Content="{Binding Path=ChartName}" />

 

 

 

 

                    </telerik:ChartDefaultView.ChartTitle>

 

 

 

 

                    <telerik:ChartDefaultView.ChartLegend>

 

 

 

 

                            <telerik:ChartLegend Header="GDF"/>

 

 

 

 

                    </telerik:ChartDefaultView.ChartLegend>

 

 

 

 

                    <telerik:ChartDefaultView.ChartArea>

 

 

 

 

                            <telerik:ChartArea PlotAreaStyle="{StaticResource customStyle}">

 

 

 

 

                                    <telerik:ChartArea.AxisY>

 

 

 

 

                                            <telerik:AxisY Title="GDF" Visibility="Visible" AxisStyles="{DynamicResource customAxisTitleStyle}" />

 

 

 

 

                                    </telerik:ChartArea.AxisY>

 

 

 

 

                                    <telerik:ChartArea.AxisX>

 

 

 

 

                                            <telerik:AxisX Title="OPTIME"  Visibility="Visible" AxisStyles="{DynamicResource customAxisTitleStyle}" />

 

 

 

 

                                    </telerik:ChartArea.AxisX>

 

 

 

 

                          </telerik:ChartArea>

 

 

 

 

                    </telerik:ChartDefaultView.ChartArea>

 

 

 

 

            </telerik:ChartDefaultView>

 

 

 

 

       </telerik:RadChart.DefaultView>

 

 

 

 

        <telerik:RadChart.SeriesMappings>

 

 

 

 

                <telerik:SeriesMapping>

 

 

 

 

                        <telerik:SeriesMapping.SeriesDefinition>

 

 

 

 

                                <telerik:LineSeriesDefinition />

 

 

 

 

                         </telerik:SeriesMapping.SeriesDefinition>

 

 

 

 

                         <telerik:SeriesMapping.ItemMappings>

 

 

 

 

                                 <telerik:ItemMapping DataPointMember="YValue" FieldName="YPlotPoint" />

 

 

 

 

                         </telerik:SeriesMapping.ItemMappings>

 

 

 

 

               </telerik:SeriesMapping>

 

 

 

 

        </telerik:RadChart.SeriesMappings>

 

 

 

 

</telerik:RadChart>

 

 



 
Ves
Telerik team
 answered on 03 Sep 2009
1 answer
208 views
Hi everyone,

I know that is possible to have a pivot table with Telerick ASP.NET Gridview but is this option available with WPF gridview?

I tried to look into the documentation but don't find anything regarding binding to pivot (except in ASP.NET documentation).

thank you

regis
Vlad
Telerik team
 answered on 03 Sep 2009
0 answers
141 views
1.How to config application file in xaml ????????????
2.I need connection Strings in xaml??

anyone can help me !!!!


regards ,
Vignesh
kottu
Top achievements
Rank 1
 asked on 03 Sep 2009
6 answers
275 views
Hi All,

Is there a way to access a control that is in the first cell of a selected row during gridview selectionchanged event?
My first cell is a GridViewColumn with a combobox. It's not bind to the datasource.


In the the AddedItems or RemovedItems property of e I have the buisness object but nothing regarding the first cell/column that is not part of the datasource.

What would be the easiest way to change the selected item in the combobox when selecting a row.
I need to change the selected value in the combobox for the newly selected row and for the ex-selected rows.

thank you
regis
Top achievements
Rank 1
 answered on 02 Sep 2009
2 answers
139 views
Maybe I'm missing it, but is there a setting on the Carousel that tells it to loop around when it gets to either end of the list?
browniepoints
Top achievements
Rank 2
 answered on 02 Sep 2009
1 answer
133 views
Hello,

I'm using Vista Theme and I want to change the root line color between parent and child item. How can I do that?

Best regards,

Henrique
Miroslav
Telerik team
 answered on 02 Sep 2009
1 answer
217 views
CheckBox in my GridView looks like a disabled checkbox. only in edit mode, he looks good. How can I the "good" style set?
Vlad
Telerik team
 answered on 02 Sep 2009
8 answers
193 views
We are using the Radtreeview to show some virtual folders. We have a require ment to drop files inside the treeview.

ie, the end user can drag and drop the items from the windows explorer to the RadTreeView. But the treeview items does not automatically expands when the user drags the file over the treeview item. 

We just like to do the same of windows explorer treeview drag drop functionality. The windows explorer (win forms) treeview automatically expands while drag over an item .

How to achive that in RadTreeview?





Miroslav
Telerik team
 answered on 02 Sep 2009
2 answers
157 views
Hello
I want to have three levels of hierarchy
this is my xaml

<telerik:RadGridView  Name="gvAccount" Width="auto" ColumnsWidthMode="Fill" 
                              AutoGenerateColumns="False" FlowDirection="RightToLeft" ShowGroupPanel="False" IsFilteringAllowed="False" CanUserResizeColumns="False">  
                            <telerik:RadGridView.Columns> 
                            <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="BudgetTypeName" Header="סוג תקציב"  Width="90"/>  
                            <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="Number" Header="מספר חשבון" Width="90" /> 
                            <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="Name" Header="שם חשבון"  Width="90"/>  
                            <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="ActivityBudget" Header="הקצבה כוללת &#13;אש''ח"  Width="90"/>  
                            <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="TotalBudget" Header="יתרה&#13;לתקצוב" Width="90" /> 
                            <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="PlanBudget" Header="שריון&#13;לפעילות" Width="90"/>  
                            <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="SumActualBudget" Header="התחיבות&#13;לפעילות" Width="90" /> 
                            <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="a" Header="שולם&#13;בפועל"  Width="90"/>  
                            <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="BudgetAllocation" Header="יתרה&#13;לתשלום" Width="90"/>  
                            <telerik:GridViewComboBoxColumn DataMemberBinding="{Binding Path=ActivityTypeName}"      
                                    DisplayMemberPath="Name" SelectedValueMemberPath="Name" Header="סוג&#13;פעילות" UniqueName="ActivityTypeName" Width="90*"/>  
                        </telerik:RadGridView.Columns> 
                        <telerik:RadGridView.HierarchyChildTemplate> 
                            <DataTemplate> 
                                <StackPanel DataContext="{x:Null}">  
                                    <telerik:RadGridView CanUserReorderColumns="False" Name="gvBudget" ColumnsWidthMode="Fill" 
                                             CanUserFreezeColumns="False" ShowGroupPanel="False" AutoGenerateColumns="False" ItemsSource="{Binding}" 
                                             Loaded="OnChildGridLoaded" FlowDirection="RightToLeft" IsFilteringAllowed="False" ShowColumnHeaders="False" ColumnBackground="AliceBlue" HorizontalContentAlignment="Right" ClipToBounds="True">  
                                        <telerik:RadGridView.Columns> 
                                                <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="BudgetTypeName" Header="סוג תקציב"  Width="90"/>  
                                                <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="Number" Header="מספר חשבון"  Width="90"/>  
                                                <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="Name" Header="שם חשבון"  Width="90"/>  
                                                <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="ActivityBudget" Header="הקצבה כוללת &#13;אש''ח"  Width="90"/>  
                                                <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="TotalBudget" Header="יתרה&#13;לתקצוב"  Width="90"/>  
                                                <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="PlanBudget" Header="שריון&#13;לפעילות" Width="90"/>  
                                                <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="SumActualBudget" Header="התחיבות&#13;לפעילות"  Width="90"/>  
                                                <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="a" Header="שולם&#13;בפועל"  Width="90"/>  
                                                <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="BudgetAllocation" Header="יתרה&#13;לתשלום" Width="90"/>  
                                                <telerik:GridViewComboBoxColumn DataMemberBinding="{Binding Path=ActivityTypeName}"      
                                                    DisplayMemberPath="Name" SelectedValueMemberPath="Name" Header="סוג&#13;פעילות" UniqueName="ActivityTypeName"  Width="90*"/>  
                                        </telerik:RadGridView.Columns> 
                                        <telerik:RadGridView.HierarchyChildTemplate> 
                                            <DataTemplate> 
                                                <StackPanel DataContext="{x:Null}">  
                                                    <telerik:RadGridView CanUserReorderColumns="False" Name="gvSubBudget" ColumnsWidthMode="Fill" 
                                             CanUserFreezeColumns="False" ShowGroupPanel="False" AutoGenerateColumns="False" ItemsSource="{Binding}" 
                                             Loaded="OnSubChildGridLoaded" FlowDirection="RightToLeft" IsFilteringAllowed="False" ShowColumnHeaders="False" ColumnBackground="AliceBlue" HorizontalContentAlignment="Right" ClipToBounds="True">  
                                                        <telerik:RadGridView.Columns> 
                                                            <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="BudgetTypeName" Header="סוג תקציב"  Width="90"/>  
                                                            <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="Number" Header="מספר חשבון"  Width="90"/>  
                                                            <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="Name" Header="שם חשבון"  Width="90"/>  
                                                            <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="ActivityBudget" Header="הקצבה כוללת &#13;אש''ח"  Width="90"/>  
                                                            <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="TotalBudget" Header="יתרה&#13;לתקצוב"  Width="90"/>  
                                                            <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="PlanBudget" Header="שריון&#13;לפעילות" Width="90"/>  
                                                            <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="SumActualBudget" Header="התחיבות&#13;לפעילות"  Width="90"/>  
                                                            <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="a" Header="שולם&#13;בפועל"  Width="90"/>  
                                                            <telerik:GridViewDataColumn IsReadOnly="True" UniqueName="BudgetAllocation" Header="יתרה&#13;לתשלום" Width="90"/>  
                                                            <telerik:GridViewComboBoxColumn DataMemberBinding="{Binding Path=ActivityTypeName}"      
                                                    DisplayMemberPath="Name" SelectedValueMemberPath="Name" Header="סוג&#13;פעילות" UniqueName="ActivityTypeName"  Width="90*"/>  
                                                        </telerik:RadGridView.Columns> 
                                                    </telerik:RadGridView> 
                                                </StackPanel> 
                                            </DataTemplate> 
                                        </telerik:RadGridView.HierarchyChildTemplate> 
                                    </telerik:RadGridView> 
                                </StackPanel> 
                            </DataTemplate> 
                        </telerik:RadGridView.HierarchyChildTemplate>                       
                    </telerik:RadGridView> 

and this is my code

 private void BindDataMainGrid()  
        {  
            try  
            {  
                ((GridViewComboBoxColumn)this.gvAccount.Columns["ActivityTypeName"]).ItemsSource = ComboBoxValues.GetComboValues(CommonValues.GetActivityType());  
 
 
                DataSet dataSet = this.GetData();  
 
                // This is needed to make the grid use the HierarchyChildTemplate  
                GridViewTableDefinition detailDefinition = new GridViewTableDefinition();  
 
                // Tell the detailsDefinition to pull its data from the Details DataTable.  
                detailDefinition.DataSource = dataSet.Tables["Budget"].DefaultView;  
 
                // Specify the relation between the two tables, similar to what is done in the DataSet.  
                TableRelation tr = new TableRelation();  
                tr.FieldNames.Add(new FieldDescriptorNamePair("ID", "ParentID"));  
                detailDefinition.Relation = tr;  
 
                // Add a GridViewTableDefinition to the grid to make it use the HierarchyChildTemplate  
                // defined in XAML.  
                if (this.gvAccount.TableDefinition.ChildTableDefinitions.Count < 1)  
                    this.gvAccount.TableDefinition.ChildTableDefinitions.Add(detailDefinition);  
 
                // Bind the grid to the "master" table.  
                this.gvAccount.ItemsSource = dataSet.Tables["Account"].DefaultView;  
} 

 private DataSet GetData()  
        {  
            try  
            {  
                dsBudget dsac = ServiceData.GetBudgetsByAccount(1);  
                if (dsac != null)  
                {  
                    DataSet ds = new DataSet();  
                    //DataTable dt = dsac.Tables["Budget"];  
                    DataView dv = new DataView(dsac.Tables["Budget"], "Type=1", "", DataViewRowState.CurrentRows);  
                    ds.Tables.Add((DataTable)dv.ToTable("Account"));  
                    dv = new DataView(dsac.Tables["Budget"], "Type=2", "", DataViewRowState.CurrentRows);  
                    ds.Tables.Add((DataTable)dv.ToTable("Budget"));  
                    dv = new DataView(dsac.Tables["Budget"], "Type=3", "", DataViewRowState.CurrentRows);  
                    ds.Tables.Add((DataTable)dv.ToTable("SubBudget"));  
 
                    ds.Relations.Add("BudgetRelation",  
                    ds.Tables["Account"].Columns["ID"],  
                    ds.Tables["Budget"].Columns["ParentID"]);  
 
                    ds.Relations.Add("SubBudgetRelation",  
                    ds.Tables["Budget"].Columns["ID"],  
                    ds.Tables["SubBudget"].Columns["ParentID"]);  
 
                    return ds;  
                }  
            }  
            catch   
            {   
                  
            }  
            return null;  
        }  
    } 

My question is
what code do I have to add
in order to see the second child level

Thanks
Orit
Top achievements
Rank 1
 answered on 02 Sep 2009
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
InlineAIAssistant
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?