Search Results

Search found 1114 results on 45 pages for 'datagrid'.

Page 15/45 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • Frustrated With Wpf DataGrid

    - by user197373
    Hello Experts, I have a tabcontrol and I place datagrid inside a tabcontrol... But I could not focus that Datagrid at the load event ... Focus means I couldn't navigate through keyboard into it... I'm getting this problem only inside of the tab control otherwise it works fine...my sample project link as follows.. http://cid-0255f3152326d2b1.skydrive.live.com/browse.aspx/WPF%20Datagrid%20Problem?uc=1&nl=1 (1) Please remember note that focus means I couldn't navigate a datagrid through keyboard (2) It should be in load event......Because it works fine in other events... (3) Datagrid should be placed inside a tab control... Because it works fine outside a tab control..... I hope u wil help me... please help me out Thanks in Advance

    Read the article

  • How update dataset with datagrid view C#

    - by Paul
    I am beginner and I have this problem. How can I can update dataset with datagridview? I binding dataset in datagrid. Edit datagrid. At finish I want update dataset with datagridview. Thank you form any advice Sory, I use Winforms. Example: I bind dataset in datagridview. dataGridViewCustomers.DataSource = _ds.Tables[0]; //edit datagridview //on this place I want update dataset with datagrid view

    Read the article

  • Don't show Data in DataGrid

    - by mSafdel
    Hi in my app, I used WCF Services for load data from SQL DB then in Completed Event Handler of my ServiceClient write this code: void svc_GetOrdersCompleted(object sender, GetOrdersCompletedEventArgs e) { if (e.Error == null) { dgOrders.ItemsSource = e.Result; txtStatus.Text = ""; } else txtStatus.Text = "Error occured while loading orders from database"; } dgOrders is my DataGrid and And AutoGenerateColumns set to True. in line 5: eResult have a number of Order objects but after this code DataGrid can't show data. Why? this ia my xaml for dgOrders: <data:DataGrid x:Name="dgOrders" Grid.Row="0" Grid.Column="1" AutoGenerateColumns="True" SelectionChanged="dgOrders_SelectionChanged" Foreground="Green"> </data:DataGrid> this is my Source code please guide me.

    Read the article

  • WPF toolkit DataGrid show filds even with browsable attribute set to false

    - by Jonathan
    Hi Hi have an observable collection that I bind to a DataGrid using the itemsource property of the DataGrid. All the properties of the class inside the collection are displayed properly in the DataGrid. Now, I want to hide some fields to the DataGrid using the browsable attribute [Browsable(false)] in the class. It works well in winforms, but it seems not working in WPF. Someone knows why? I can hide the columns later, but I don't want to loss performance in this way. Is there any other solution? Thanks.

    Read the article

  • Window opened from DataGrid is placed in background

    - by 0xddr
    One column in DataGrid looks like that: <DataTemplate> <StackPanel> <Image MouseDown="OpenWindow" /> <Image MouseDown="func2"/> </StackPanel> </DataTemplate> In OpenWindow window is opened: it starts opening in foreground (in front of the window with DataGrid), but when creating UI ends it is placed behind window with DataGrid, which is not expected behavior. When I changed Image to Button and MouseDown to Click everything works as it should (opened window is placed in front of the one with DataGrid).

    Read the article

  • custom control in DataGridTemplateColumn

    - by Johnsonlu
    Hi all, I'd like to add my custom control into a template column of data grid. The custom control is very similar to a text box, but has an icon in it. The user can click the icon, and selects an item from a prompted window, then the selected item will be filled into the text box. My problem is when the text box is filled, after I click the second column, the text will disappear. If I replace the custom control with a simple text box, the result is the same. Here is the sample code: //Employee.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace SimpleGridTest { public class Employee { public string Department { get; set; } public int ID { get; set; } public string Name { get; set; } } } Mainwindow.xaml <Window x:Class="SimpleGridTest.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <DataGrid x:Name="grid" Grid.Row="1" Margin="5" AutoGenerateColumns="False" RowHeight="25" RowHeaderWidth="10" ItemsSource="{Binding}" CanUserAddRows="True" CanUserSortColumns="False"> <DataGrid.Columns> <DataGridTemplateColumn Header="Department" Width="150"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBox Text="{Binding Department}" /> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> <DataGridTextColumn Header="ID" Binding="{Binding Path=ID}" Width="100"/> <DataGridTextColumn Header="Name" Binding="{Binding Path=Name}" Width="200"/> </DataGrid.Columns> </DataGrid> </Grid> </Window> MainWindow.xaml.cs using System.Windows; using System.Collections.ObjectModel; namespace SimpleGridTest { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { private ObservableCollection<Employee> _employees = new ObservableCollection<Employee>(); public ObservableCollection<Employee> Employees { get { return _employees; } set { _employees = value; } } public MainWindow() { InitializeComponent(); grid.ItemsSource = Employees; } } } How can I fix this problem? Or I need to write a DataGrid***Column as DataGridTextColumn? Thanks in advance! Best Regards, Johnson

    Read the article

  • Access to DataTemplate Control of WPF Toolkit DataGridCell at Runtime, How?

    - by LukePet
    I have a DataGrid defined with WPF Toolkit. The CellEditingTemplate of this DataGrid is associated at runtime with a custom function that build a FrameworkElementFactory element. Now I have to access to control that is inserted inside DataTemplate of CellEditingTempleta, but I do not know how to do. On web I found a useful ListView Helper... public static class ListViewHelper { public static FrameworkElement GetElementFromCellTemplate(ListView listView, Int32 column, Int32 row, String name) { if (row >= listView.Items.Count || row < 0) { throw new ArgumentOutOfRangeException("row"); } GridView gridView = listView.View as GridView; if (gridView == null) { return null; } if (column >= gridView.Columns.Count || column < 0) { throw new ArgumentOutOfRangeException("column"); } ListViewItem item = listView.ItemContainerGenerator.ContainerFromItem(listView.Items[row]) as ListViewItem; if (item != null) { GridViewRowPresenter rowPresenter = GetFrameworkElementByName<GridViewRowPresenter>(item); if (rowPresenter != null) { ContentPresenter templatedParent = VisualTreeHelper.GetChild(rowPresenter, column) as ContentPresenter; DataTemplate dataTemplate = gridView.Columns[column].CellTemplate; if (dataTemplate != null && templatedParent != null) { return dataTemplate.FindName(name, templatedParent) as FrameworkElement; } } } return null; } private static T GetFrameworkElementByName<T>(FrameworkElement referenceElement) where T : FrameworkElement { FrameworkElement child = null; for (Int32 i = 0; i < VisualTreeHelper.GetChildrenCount(referenceElement); i++) { child = VisualTreeHelper.GetChild(referenceElement, i) as FrameworkElement; System.Diagnostics.Debug.WriteLine(child); if (child != null && child.GetType() == typeof(T)) { break; } else if (child != null) { child = GetFrameworkElementByName<T>(child); if (child != null && child.GetType() == typeof(T)) { break; } } } return child as T; } } this code work with the ListView object but not with the DataGrid object. How can use something like this in DataGrid?

    Read the article

  • Validating a value for a DataColumn

    - by Richard Neil Ilagan
    Hello! I'm using a DataGrid with edit functionalities in my project. It's handy, compared to having to edit its source data manually, but sadly, that means that I'll have to deal with validating user input a bit more. And my problem is basically just that. When I set my DataGrid to EDIT mode, modify the values and then set it to UPDATE, what is the best way to check if a value that I've entered is, in fact, compatible with the corresponding column's data type? i.e. (simple example) // assuming DataTable dt = new DataTable(); dt.Columns.Add("aa",typeof(System.Int32)); DataGrid dg = new DataGrid(); dg.DataSource = dt; dg.DataBind(); dg.UpdateCommand += dg_Update; // this is the update handler protected void dg_Update(object src, DataGridCommandEventArgs e) { string newValue = (someValueIEnteredInTextBox); // HOW DO I CHECK IF [newValue] IS COMPATIBLE WITH COLUMN "aa" ABOVE? dt.LoadDataRow(newValue, true); } Thanks guys. Any leads would be so much help.

    Read the article

  • WPF: How to get Binding.Converter

    - by Nike
    I create DataGrid Columns with Binding (where i is a Int value): dataGrid.Columns.Add(new DataGridTextColumn { Header = i.ToString(), Binding = CreateBinding(i), }); private Binding CreateBinding(int num) { Binding bind = new Binding(string.Format("[{0}]", num)); bind.Converter = new CellValueConverter(); return bind; } In the CreateBinding method I have an access to bind.Converter property. I need to call Converter.Convert() method in some handler, but there is no Converter property when I try to access it: (dataGrid.Columns[clm] as DataGridTextColumn).Binding."no Converter property!" How can I get my CellValueConverter which was created for particular Column?

    Read the article

  • Silverlight4 Printing Question

    - by hallgato.attila
    Hello everyone! I'm having a problem with printing. Is it possible to print a (customized) DataGrid which doesn't fit the page? a) Using a ViewBox to make it fit one page. My problem here is that I can get the PrintableArea.Width and PrintableArea.Height in the PrintPage EventHandler, from the PrintPageEventArgs, but in that Event Handler I can't set the size of an UIElement before it gets printed. b) Multiple pages. Is it possible somehow to print the whole DataGrid, even the parts which are not visible (don't fit the page) and to somehow make the PrintableArea only a part of the DataGrid?

    Read the article

  • How to get the right row in a sorted DataView?

    - by ZeissS
    Hi, I have a DataGrid containing a small table. Until now, I had a double click handler on this grid which iterated over all rows to find the selected one: DataTable table = (DataTable)this.dataGrid.DataSource; int selectedRow = -1; for (int i=0; i<table.Rows.Count; i++) if (this.dataGrid.IsSelected(i)) selectedRow = i; break; } if ( selectedRow != -1 ) { DataRow row = table.Rows[selectedRow]; // More code ... } Problem: When the user clicks on a column header and sort the table, table.Rows does not return the right rows. It still contains the unsorted rows. How can I get the right column?

    Read the article

  • WPF DataGrid does not scoll on drag

    - by Greg R
    I have a strange problem with a WPF DataGrid from WPF Toolkit. The scrollbars appear correctly when the number of rows grows, and the scrolling works when you press up or down arrows on the scrollbar. The problem comes in when I try to drag the scrollbar on the datagrid. My page has a scroll viewer around it. When I click and drag the scrollbar on the grid, it scrolls the page scroller instead. If the scrollbar does not apear on the page, there grid still does not scroll. Is there a workaround for this??? Would really appreciate some help with this issue! For example, in this case if the page is < 280, it scrolls on drag. But drag scrolling does not work on the grid. <ScrollViewer ScrollViewer.IsDeferredScrollingEnabled="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" > <DockPanel> <dg:DataGrid HorizontalScrollBarVisibility="Auto" SelectionMode="Single" CanUserAddRows="False" CanUserDeleteRows="False" CanUserResizeColumns="False" CanUserSortColumns="False" AutoGenerateColumns="False" RowHeaderWidth="17" ItemsSource="{Binding Path=OrderSearchVm}" IsReadOnly="True" MaxHeight="280" DockPanel.Dock="Top"> <dg:DataGrid.Columns> <dg:DataGridTextColumn Width="75" Header="Date" Binding="{Binding Path=OrderDate}" > <dg:DataGridTextColumn.ElementStyle> <Style TargetType="{x:Type TextBlock}"> <Setter Property="TextWrapping" Value="Wrap" /> </Style> </dg:DataGridTextColumn.ElementStyle> </dg:DataGridTextColumn> <dg:DataGridTextColumn Header="Type" Binding="{Binding Path=OrderType}" Width="45"/> <dg:DataGridTextColumn Header="Shipping Name" Binding="{Binding Path=ShipToName}" Width="115"> <dg:DataGridTextColumn.ElementStyle> <Style TargetType="{x:Type TextBlock}"> <Setter Property="TextWrapping" Value="Wrap" /> </Style> </dg:DataGridTextColumn.ElementStyle> </dg:DataGridTextColumn> <dg:DataGridTextColumn Header="Shipping Address " Binding="{Binding Path=ShipToAddress}" Width="160"> <dg:DataGridTextColumn.ElementStyle> <Style TargetType="{x:Type TextBlock}"> <Setter Property="TextWrapping" Value="Wrap" /> </Style> </dg:DataGridTextColumn.ElementStyle> </dg:DataGridTextColumn> <dg:DataGridTextColumn Header="E-Mail" Binding="{Binding Path=Email}" Width="140"> <dg:DataGridTextColumn.ElementStyle> <Style TargetType="{x:Type TextBlock}"> <Setter Property="TextWrapping" Value="Wrap" /> </Style> </dg:DataGridTextColumn.ElementStyle> </dg:DataGridTextColumn> </dg:DataGrid.Columns> </dg:DataGrid> </DockPanel> </ScrollViewer>

    Read the article

  • Flex/Flash 4 datagrid displays raw xml

    - by Setori
    Problem: Flex/Flash4 client (built with FlashBuilder4) displays the xml sent from the server exactly as is - the datagrid keeps the format of the xml. I need the datagrid to parse the input and place the data in the correct rows and columns of the datagrid. flow: click on a date in the tree and it makes a server request for batch information in xml form. Using a CallResponder I then update the datagrid's dataProvider. [code] <fx:Script> <![CDATA[ import mx.controls.Alert; [Bindable]public var selectedTreeNode:XML; public function taskTreeChanged(event:Event):void { selectedTreeNode=Tree(event.target).selectedItem as XML; var searchHubId:String = selectedTreeNode.@hub; var searchDate:String = selectedTreeNode.@lbl; if((searchHubId == "") || (searchDate == "")){ return; } findShipmentBatches(searchDate,searchHubId); } protected function findShipmentBatches(searchDate:String, searchHubId:String):void{ findShipmentBatchesResult.token = actWs.findShipmentBatches(searchDate, searchHubId); } protected function updateBatchDataGridDP():void{ task_list_dg.dataProvider = findShipmentBatchesResult.lastResult; } ]]> </fx:Script> <fx:Declarations> <actws:ActWs id="actWs" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/> <s:CallResponder id="findShipmentBatchesResult" result="updateBatchDataGridDP()"/> </fx:Declarations> <mx:AdvancedDataGrid id="task_list_dg" width="100%" height="95%" paddingLeft="0" paddingTop="0" paddingBottom="0"> <mx:columns> <mx:AdvancedDataGridColumn headerText="Receiving date" dataField="rd"/> <mx:AdvancedDataGridColumn headerText="Msg type" dataField="mt"/> <mx:AdvancedDataGridColumn headerText="SSD" dataField="ssd"/> <mx:AdvancedDataGridColumn headerText="Shipping site" dataField="sss"/> <mx:AdvancedDataGridColumn headerText="File name" dataField="fn"/> <mx:AdvancedDataGridColumn headerText="Batch number" dataField="bn"/> </mx:columns> </mx:AdvancedDataGrid> //xml example from server <batches> <batch> <rd>2010-04-23 16:31:00.0</rd> <mt>SC1REVISION01</mt> <ssd>2010-02-18 00:00:00.0</ssd> <sss>100000009</sss> <fn>Revision 1-DF-Ocean-SC1SUM-Quanta-PACT-EMEA-Scheduled Ship Date 20100218.csv</fn> <bn>10041</bn> </batch> <batches> [/code] and the xml is pretty much displayed exactly as is shown in the example above in the datagrid columns... I would appreciate your assistance.

    Read the article

  • Flex/Flash 4 datagrid literally displays XML

    - by Setori
    Problem: Flex/Flash4 client (built with FlashBuilder4) displays the xml sent from the server exactly as is - the datagrid keeps the format of the xml. I need the datagrid to parse the input and place the data in the correct rows and columns of the datagrid. flow: click on a date in the tree and it makes a server request for batch information in xml form. Using a CallResponder I then update the datagrid's dataProvider. [code] <fx:Script> <![CDATA[ import mx.controls.Alert; [Bindable]public var selectedTreeNode:XML; public function taskTreeChanged(event:Event):void { selectedTreeNode=Tree(event.target).selectedItem as XML; var searchHubId:String = selectedTreeNode.@hub; var searchDate:String = selectedTreeNode.@lbl; if((searchHubId == "") || (searchDate == "")){ return; } findShipmentBatches(searchDate,searchHubId); } protected function findShipmentBatches(searchDate:String, searchHubId:String):void{ findShipmentBatchesResult.token = actWs.findShipmentBatches(searchDate, searchHubId); } protected function updateBatchDataGridDP():void{ task_list_dg.dataProvider = findShipmentBatchesResult.lastResult; } ]]> </fx:Script> <fx:Declarations> <actws:ActWs id="actWs" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/> <s:CallResponder id="findShipmentBatchesResult" result="updateBatchDataGridDP()"/> </fx:Declarations> <mx:AdvancedDataGrid id="task_list_dg" width="100%" height="95%" paddingLeft="0" paddingTop="0" paddingBottom="0"> <mx:columns> <mx:AdvancedDataGridColumn headerText="Receiving date" dataField="rd"/> <mx:AdvancedDataGridColumn headerText="Msg type" dataField="mt"/> <mx:AdvancedDataGridColumn headerText="SSD" dataField="ssd"/> <mx:AdvancedDataGridColumn headerText="Shipping site" dataField="sss"/> <mx:AdvancedDataGridColumn headerText="File name" dataField="fn"/> <mx:AdvancedDataGridColumn headerText="Batch number" dataField="bn"/> </mx:columns> </mx:AdvancedDataGrid> [/code] I cannot upload a pic, but this is the xml: [code] 2010-04-23 16:35:51.0 PRESHIP 2010-02-15 00:00:00.0 100000009 DF-Ocean-PRESHIPSUM-Quanta-PACT-EMEA-Scheduled Ship Date 20100215.csv 10053 [/code] and the xml is pretty much displayed exactly as is in the datagrid columns... I would appreciate your assistance.

    Read the article

  • WPF 4 Datagrid with ComboBox

    - by Doug
    I have a WPF 4 app with a ComboBox embedded in a DataGrid. The ComboBox is in a template column that displays the combobox when in edit mode but just a TextBlock otherwise. If I edit the cell and pick a new value from the combobox, when leaving the cell, the TextBlock in view mode does not reflect the new value. Ultimately, the new value gets saved and is displayed when the window is refreshed but it does not happen while still editing in the grid. Here are the parts that are making this more complicated. The grid and the combobox are bound to different ItemsSource from the EnityFramework which is tied to my database. For this problem, the grid is displaying project members. The project member name can be picked from the combobox which gives a list of all company employees. Any ideas on how to tie the view mode of the DataGridColumnTemplate to the edit value when they are pointing to different DataSources? Relevant XAML <Window.Resources> <ObjectDataProvider x:Key="EmployeeODP" /> </Window.Resources> <StackPanel> <DataGrid Name="teamProjectGrid" AutoGenerateColumns="false" ItemsSource="{Binding Path=ProjectMembers}" <DataGrid.Columns> <DataGridTemplateColumn Header="Name" x:Name="colProjectMember"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding Path=ProjectMemberFullName}" /> </DataTemplate> </DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellEditingTemplate> <DataTemplate> <ComboBox x:Name="ProjectMemberCombo" IsReadOnly="True" DisplayMemberPath="FullName" SelectedValue="{Binding Path=Employee}" ItemsSource="{Binding Source={StaticResource EmployeeODP}}" /> </DataTemplate> </DataGridTemplateColumn.CellEditingTemplate> </DataGridTemplateColumn> <DataGridTextColumn x:Name="colProjectRole" Binding="{Binding Path=ProjectRole}" Header="Role" /> </DataGrid.Columns> </DataGrid> </StackPanel> Relevant Code Behind this.DataContext = new MyEntityLibrary.MyProjectEntities(); ObjectDataProvider EmployeeODP= (ObjectDataProvider)FindResource("EmployeeODP"); if (EmployeeODP != null) { EmployeeODP.ObjectInstance = this.DataContext.Employees; }

    Read the article

  • Initialization of ComboBox in datagrid, Silverlight 4.0

    - by Budda
    I have datagrid with list of MyPlayer objects linked to ItemsSource, there are ComboBoxes inside of grid that are linked to a list of inner object, and binding works correctly: when I select one of the item then its value is pushed to data model and appropriately updated in other places, where it is used. The only problem: initial selections are not displayed in my ComboBoxes. I don't know why..? Instance of the ViewModel is assigned to view DataContext. Here is grid with ComboBoxes (grid is binded to the SquadPlayers property of ViewModel): <data:DataGrid ="True" AutoGenerateColumns="False" ItemsSource="{Binding SquadPlayers}"> <data:DataGrid.Columns> <data:DataGridTemplateColumn Header="Rig." Width="50"> <data:DataGridTemplateColumn.CellTemplate> <DataTemplate> <ComboBox SelectedItem="{Binding Rigid, Mode=TwoWay}" ItemsSource="{Binding IntLevels, Mode=TwoWay}"/> </DataTemplate> </data:DataGridTemplateColumn.CellTemplate> </data:DataGridTemplateColumn> </data:DataGrid.Columns> </data:DataGrid> Here is ViewModel class ('_model_DataReceivedEvent' method is called asynchronously, when data are received from server): public class SquadViewModel : ViewModelBase<SquadModel> { public SquadViewModel() { SquadPlayers = new ObservableCollection<SquadPlayer>(); } private void _model_DataReceivedEvent(List<SostavPlayerData> allReadyPlayers) { TeamTask task = new TeamTask { Rigid = 1 }; foreach (SostavPlayerData spd in allReadyPlayers) { SquadPlayer sp = new SquadPlayer(spd, task); SquadPlayers.Add(sp); } RaisePropertyChanged("SquadPlayers"); } And here is SquadPlayer class (it's objects are binded to the grid rows): public class SquadPlayer : INotifyPropertyChanged { public SquadPlayer(SostavPlayerData spd) { _spd = spd; Rigid = 2; } public event PropertyChangedEventHandler PropertyChanged; private int _rigid; public int Rigid { get { return _rigid; } set { _rigid = value; if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs("Rigid")); } } } private readonly ObservableCollection<int> _statIntLevels = new ObservableCollection<int> { 1, 2, 3, 4, 5 }; public ObservableCollection<int> IntLevels { get { return _statIntLevels; } } It is expected to have all "Rigid" comboboxes set to "2" value, but they are not selected (items are in the drop-down list, and if any value is selected it is going to ViewModel). What is wrong with this example? Any help will be welcome. Thanks.

    Read the article

  • WPF Datagrid items binding problem

    - by gencay
    I get a problem while displaying a List in WPF-Datagrid. When I do this line ... DocumentList dt = new DocumentList(fileWordList, fileUriType, fileUri, cosineSimilarityRatio, diceSimilarityRatio, extendedJaccardSimilarityRatio); documentList.Add(dt); ... dataGrid1.Items.Add(dt); ... It creates an empty row into dataGrid1 and no text is shown there. my xaml implementation is this: <GroupBox Canvas.Left="-0.003" Canvas.Top="0" Header="Display Results" Height="427.5" Name="groupBox2" Width="645.56"> <toolkit:DataGrid Canvas.Left="137.5" Canvas.Top="240" Height="392" Name="dgrDocumentList" Width="627" ItemsSource="{Binding DocumentList }"> <toolkit:DataGrid.Columns> <toolkit:DataGridTextColumn Header="Type" Binding="{Binding type}" IsReadOnly="True"> </toolkit:DataGridTextColumn> <toolkit:DataGridHyperlinkColumn Header="Uri" Binding="{Binding path}" IsReadOnly="True"> </toolkit:DataGridHyperlinkColumn> <toolkit:DataGridTextColumn Header="Cosine" Binding="{Binding cos}" IsReadOnly="True"> </toolkit:DataGridTextColumn> <toolkit:DataGridTextColumn Header="Dice" Binding="{Binding dice}" IsReadOnly="True"> </toolkit:DataGridTextColumn> <toolkit:DataGridTextColumn Header="Jaccard" Binding="{Binding jaccard}" IsReadOnly="True"> </toolkit:DataGridTextColumn> </toolkit:DataGrid.Columns> </toolkit:DataGrid> </GroupBox> and my DocumentList class class DocumentList { public List<WordList> wordList; public string type; public string path; public double cos; public double dice; public double jaccard; //public static string title; public DocumentList(List<WordList> wordListt, string typee, string pathh, double sm11, double sm22, double sm33) { type = typee; wordList = wordListt; path = pathh; cos = sm11; dice = sm22; jaccard = sm33; } I would like to do that: When i add a new element into documentList instance, would like to see the results on data grid. Thank you in advance.

    Read the article

  • how to bind the image dynamically for datagrid in.cs

    - by prince23
    hi, this is my xaml code. <sdk:DataGrid x:Name="dgMarks" CanUserResizeColumns="False" SelectionMode="Single" AutoGenerateColumns="False" VerticalAlignment="Top" IsReadOnly="True" Margin="13,44,0,0" RowDetailsVisibilityChanged="dgMarks_RowDetailsVisibilityChanged" RowDetailsVisibilityMode="Collapsed" Height="391" HorizontalAlignment="Left" Width="965" SelectionChanged="dgMarks_SelectionChanged" VerticalScrollBarVisibility="Visible" > <sdk:DataGrid.Columns> <sdk:DataGridTemplateColumn> <sdk:DataGridTemplateColumn.CellTemplate> <DataTemplate> <Button x:Name="myButton" Click="ExpandMarks_Click"> <TextBlock Text="{Binding Level}" TextWrapping="NoWrap" ></TextBlock> <Image x:Name="imgMarks" Stretch="None"/> </Button> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> <sdk:DataGridTemplateColumn Header="Name" Visibility="Collapsed"> <sdk:DataGridTemplateColumn.CellTemplate> <DataTemplate > <sdk:Label Content="{Binding Name}"/> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> <sdk:DataGridTemplateColumn Header="Marks" Width="80"> <sdk:DataGridTemplateColumn.CellTemplate> <DataTemplate> <sdk:Label Content="{Binding Marks}"/> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> </sdk:DataGrid.Columns> </sdk:DataGrid> from database i am getting these values name marks Level abc 23 0 xyz 67 1 yu 56 0 aa 89 1 here i am binding these values for datagrid. i have an tricky thing to be done .based on the level i should be binding image if level value is 1 then bind the image. if level value is 0 then do not bind the image for that row i know this is how we need to handle but where should i write this code in which events? Image imgLevel = (Image)templateTrendScore.FindName("imgMarks"); if (level1==1) { imgLevel .Source = new BitmapImage(new Uri("/Images/image1.JPG", UriKind.Relative)); } any help would be great thanks in advance

    Read the article

  • WPF DATAGRID CELL CONTENTS ALIGNMENT

    - by Ulhas Tuscano
    Hi, I have a WPF DataGrid control I am binding the objects of class Customer to DataGrid Rows using ObservableCollection at run time. I have set MinRowHeight="100" & I want the rows of DataGrid should be HorizontallyAligned at Center & Vertically at Left. Setting DataGrid properties VerticalContentAlignment="Center" HorizontalContentAlignment="Center" doesn't help. Code :--- System.Collections.ObjectModel.ObservableCollection cust1 = new System.Collections.ObjectModel.ObservableCollection { new Customer{FirstName="Ulhas",LastName="TUSCANO",IsMember = true ,Email="[email protected]",Status=OrderStatus.Processing }, new Customer{FirstName="Neville",LastName="TUSCANO",IsMember = true ,Email="[email protected]",Status=OrderStatus.Received }, new Customer{FirstName="Pascoal",LastName="TUSCANO",IsMember = true ,Email="[email protected]",Status=OrderStatus.None }, new Customer{FirstName="Mary",LastName="TUSCANO",IsMember = true ,Email="[email protected]",Status=OrderStatus.Received }, new Customer{FirstName="Mary",LastName="TUSCANO",IsMember = true ,Email="[email protected]",Status=OrderStatus.Received }, new Customer{FirstName="Mary",LastName="TUSCANO",IsMember = true ,Email="[email protected]",Status=OrderStatus.Received }, }; dataGrid1.ItemsSource = cust1; public class Customer { public string FirstName{get;set;} public string LastName { get; set; } public string Email { get; set; } public bool IsMember { get; set; } public OrderStatus Status { get; set; } } Any help will be greatly appreciated, Thanx

    Read the article

  • XAML ContextMenu gets bound to wrong row in a DataGrid

    - by Simon_Weaver
    I have a XAML based ContextMenu bound to the rows in a datagrid. It works just fine - until the grid is scrolled! This is the context menu for one of the controls in the visual tree or a DataGrid row. <data:DataGridTemplateColumn Header="Customer Details" Width="*"> <data:DataGridTemplateColumn.CellTemplate> <DataTemplate> <Grid Background="Transparent"> <!-- allows click in entire cell --> <controlsInputToolkit:ContextMenuService.ContextMenu> <controlsInputToolkit:ContextMenu> <controlsInputToolkit:MenuItem Header="{Binding CompletedOrderId,StringFormat='Create Reminder for order #\{0\}'}" CommandParameter="{Binding}"> <controlsInputToolkit:MenuItem.Command> <command:CreateReminderCommand/> </controlsInputToolkit:MenuItem.Command> <controlsInputToolkit:MenuItem.Icon> <Viewbox> <Image Width="19" Height="18" Source="../images/reminders.png" VerticalAlignment="Center"/> </Viewbox> </controlsInputToolkit:MenuItem.Icon> </controlsInputToolkit:MenuItem> <controlsInputToolkit:ContextMenu> <controlsInputToolkit:ContextMenuService.ContextMenu> ...... The ICommand is CreateReminderCommand and the CommandParameter is bound to the data item for the row itself. This works just fine - I can right click on a row and it will show me the correct text in the menu item 'Create Reminder for order 12345'. Then I scroll the datagrid down a page. If I keep right clicking on items then suddenly I'll see the wrong order number for a row. I think what must be happening is this : The DataGrid is reusing instances of MenuItem that it has previously created. How can I force a refresh of the ContextMenu when it is displayed for an item that changes? There's no 'Update method on the ContextMenu or ContextMenuService.

    Read the article

  • Dojo DataGrid, programmatic creation

    - by djna
    I'm trying to create a DataGrid dynamically. Declarative creation is working fine: A source of data: <span dojoType="dojo.data.ItemFileReadStore" jsId="theStore" url="dataonly001.json"> </span> a simple layout: <script type="text/javascript" > var layout = [ { field: 'custId', name: 'Id', } // more items elided ... ]; </script> The grid: <body class="tundra" id="mainbody"> <div id="grid" dojoType="dojox.grid.DataGrid" store="theStore" structure="layout" autoWidth="true" ></div> </body> And I get the grid displayed nicely. Instead, I want to create the grid dynamically. For the sake of figuring out what's broken I've tried to use exactly the same layout and store, removing just teh grid declaration and adding this script: <script type="text/javascript" djConfig="parseOnLoad: true, debugAtAllCosts: true"> dojo.addOnLoad(function(){ // initialise and lay out home page console.log("Have a store:" + theStore); console.log("Have a structure:" + layout); var grid = new dojox.grid.DataGrid({ id:"grid", store : theStore, clientSort : "true", structure : layout }); grid.startup(); dojo.place(grid.domNode, dojo.body(), "first"); }); </script> The effect that I get is a completely empty rectangle is displayed. Using FireBug I can see that the DataGrid widget is created but that it has no rows or columns. So my guess is that the datastore or layout are not being passed correctly. However, it does appear that at the point of creation the values of theStore and layout are correct. Suggestions please, or indeed a working example of a programmic grid might solve the problem.

    Read the article

  • Calling a datatrigger for a radio button inside a datagrid

    - by Farax
    I have a datagrid with one column having a radio button. I want to set the GroupName when a certain condition is reached. Below is the code <Custom:DataGrid.Columns> <!-- ONLY ENABLED WHEN THE ITEM TYPE IS SINGLESELECT OR SINGLESELECT WITH ADDIOTIONAL DATA--> <Custom:DataGridTemplateColumn CanUserResize="False" MinWidth="20" > <Custom:DataGridTemplateColumn.CellTemplate> <DataTemplate> <RadioButton IsChecked="{Binding IsChecked}" d:DesignWidth="16" d:DesignHeight="16" GroupName="SingleChoiceSelection" Template="{DynamicResource RadioButtonTemplate}" Background="{DynamicResource BackgroundNew}" BorderBrush="#FF7A7171" Foreground="#FF6C6C6C" Margin="0" /> </DataTemplate> </Custom:DataGridTemplateColumn.CellTemplate> </Custom:DataGridTemplateColumn> <Custom:DataGridTextColumn Header="Choices" Binding="{Binding ChoiceText}" CellStyle="{DynamicResource DataGridCellStyle2}" MinWidth="150" /> </Custom:DataGrid.Columns> </Custom:DataGrid> The ItemSource contains a property called isChecked and I want to change the foreground color when isChecked is changed to true. How do i do this with a datatrigger?

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >