Search Results

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

Page 10/45 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • How to get a ListView (or DataGrid) work with TextWrapping (WPF)

    - by Aks1
    I mean, i have one of this controls and text inside one of it's columns. Usually if user changes column size, it's just cutting text. If I'm trying to use template with textblock or textbox and set TextWrapping="Wrap" inside of the template - it's really doesn't change anything. What's the way out? *And yes, I searched before asking, and found similar questions on this site. But without answer ((( *

    Read the article

  • Arbitrary Header content for each row in WPF datagrid

    - by tk
    I'm trying to put row header text based on a converter function of the index of the row. I found a way to bind to the datagridrow like below, but i can't find how to get the row index of the datagridrow object. <DataTemplate x:Key="MyRowHeaderTemplate" DataType="DataRowView"> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Margin="1,0,1,0" Padding="1,0,1,0" Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type DataGridRow}}, Path=Item}"/> </DataTemplate> How can i get the row index and use my converter function to set the row header text?

    Read the article

  • Bind a list to silverlight datagrid/datafrom columns

    - by nilarya
    There must be something I am missing, I want to do a very simple thing, for example, I have a class like the following: public class Person { public int ID { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public DateTime DateOfBirth { get; set; } public List<string> phoneNumbers { get; set; } } I want to bind it to a dataform by something like this: public Person person { get; set; } List<string> lst = new List<string>(); lst.Add("123445"); lst.Add("2345345"); lst.Add("4576345"); lst.Add("456784"); lst.Add("789067"); person = new Person() { ID = 1, FirstName = "Kevin", LastName = "Dockx", DateOfBirth = new DateTime(1981, 5, 5), Lookup = lst }; and then dataForm1.CurrentItem = person; What I am doing wrong?

    Read the article

  • WPF Datagrid Column Width codebehind

    - by mikemuhl
    Hi, i would like to replace the following xaml code : <Custom:DataGridTextColumn Header=" " Width="*"/>in codebehind. This xaml code fills my header to the end with my style.. this is what i want to get |name | number | this area uses "mystyle" end of grid -| this is what i now get : |name | number | unstyled area! end of grid -| as u see, i would like to fill the unstyled area with my style, done this with xaml: now need in cb pls ;)

    Read the article

  • Creating an IF statement for datagrid value

    - by EvanRyan
    This is something I thought would be easier than it's turning out to be. For whatever reason, I can't seem to figure out a way to make what I'm trying to do here work with an If statement: List<int> miscTimes = new List<int>(); for (int i = 0; i < MISCdataGridView1.RowCount; i++) { if (MISCdataGridView1.Rows[i].Cells[2].Value == "Something") { miscTimes.Add(Convert.ToInt32(MISCdataGridView1.Rows[i].Cells[3].Value)); } } return miscTimes; For some reason, I can't get it to like anything I do with the if statement. I've tried converting to string and all of that. How should I go about this?

    Read the article

  • Code thinks Datagrid footer textbox is empty...

    - by The Sheek Geek
    Hello All, I am working on an .net (C#) web application. Recently a defect came my way that stated that when two users were logged into the application at the same time they both could not update values without one refreshing the page. When I looked into the issue I discovered that the author of the code has used static datasets. I changed the datasets to not be static and everything works great. However, This issue spans many pages in the application and I must fix it everywhere. On some of these pages the application uses datasets to bind data to datagrids. The datagrids are populated with the information in the dataset and the footer contains some textboxes and an add button to add extra rows. Here is where the problem starts: When the page was using static datasets and the user attempted to add a row through the interface everything worked fine. However, when I changed it to use datasets that were not static (they are loaded every time the page loads) and the user attempts to add a row, the code thinks that the textbox is empty (discovered when debugging even though I can see the text that I entered) and empty field validation fails and a message is displayed. Can someone please tell me why on Earth this is happening? Why does it see the text when the dataset is static (the dataset NEVER populates the foot row) and not see the text when it is not static? Some insight would be awesome! Thanks in advance!

    Read the article

  • Pass data to Child Window in Silverlight 4 using MVVM

    - by Archie
    Hello, I have a datagrid with master detail implementation as follows: <data:DataGrid x:Name="dgData" Width="600" ItemsSource="{Binding Path=ItemCollection}" HorizontalScrollBarVisibility="Hidden" CanUserSortColumns="False" RowDetailsVisibilityChanged="dgData_RowDetailsVisibilityChanged"> <data:DataGrid.Columns> <data:DataGridTextColumn Header="Item" Width="*" Binding="{Binding Item,Mode=TwoWay}"/> <data:DataGridTextColumn Header="Company" Width="*" Binding="{Binding Company,Mode=TwoWay}"/> </data:DataGrid.Columns> <data:DataGrid.RowDetailsTemplate> <DataTemplate> <data:DataGrid x:Name="dgrdRowDetail" Width="400" AutoGenerateColumns="False" HorizontalAlignment="Center" HorizontalScrollBarVisibility="Hidden" Grid.Row="1"> <data:DataGrid.Columns> <data:DataGridTextColumn Header="Date" Width="*" Binding="{Binding Date,Mode=TwoWay}"/> <data:DataGridTextColumn Header="Price" Width="*" Binding="{Binding Price, Mode=TwoWay}"/> <data:DataGridTemplateColumn> <data:DataGridTemplateColumn.CellTemplate> <DataTemplate> <Button Content="Show More Details" Click="buttonShowDetail_Click"></Button> </DataTemplate> </data:DataGridTemplateColumn.CellTemplate> </data:DataGridTemplateColumn> </data:DataGrid.Columns> </data:DataGrid> </DataTemplate> </data:DataGrid.RowDetailsTemplate> </data:DataGrid> I want to open a Child window in clicking the button which shows more details about the product. I'm using MVVM pattern. My Model contains a method which takes the Item name as input and retursn the Details data. My problem is how should I pass the Item to ViewModel which will get the Details data from Model? and where shoukd I open the new Child Window? In View or ViewModel? Please help.Thanks.

    Read the article

  • WPF DataGrid duplicates new row when new item is attached to the source collection.

    - by Shimmy
    <Page> <Page.Resources> <data:Quote x:Key="Quote"/> </Page.Resources> <tk:DataGrid DataContext="{Binding Quote}" ItemsSource="{Binding Rooms}"> <tk:DataGrid/> </Page> Code: Private Sub InitializingNewItem _ (sender As DataGrid, _ ByVal e As InitializingNewItemEventArgs) _ Handles dgRooms.InitializingNewItem Dim room = DirectCast(e.NewItem, Room) 'Room is subclass of EntityObject Dim state = room.EntityState 'Detached Dim quote = Resources("Quote") state = quote.EntityState 'Unchanged 'either one of these lines causes the new row to go duplicated: quote.Rooms.Add(room) room.Quote = quote 'I tried: sender.Items.Refresh 'I also tried to remove the detached entity from the DataGrid and create a 'new item but it they throw exceptions saying the the Items is untouchable. End If

    Read the article

  • expand an collapse button in datagrid

    - by prince23
    hi, <sdk:DataGrid MinHeight="100" x:Name="dgCounty" AutoGenerateColumns="False" VerticalAlignment="Top" IsReadOnly="True" Margin="5,5,5,0" RowDetailsVisibilityChanged="dgCounty_RowDetailsVisibilityChanged" RowDetailsVisibilityMode="VisibleWhenSelected"> <sdk:DataGrid.Columns> <sdk:DataGridTemplateColumn CanUserReorder="False"> <sdk:DataGridTemplateColumn.CellTemplate> <DataTemplate> <Button x:Name="ViewButton" Click="ToggleRowDetailsVisibility" Cursor="Hand" Content="View Details" /> </DataTemplate> </sdk:DataGridTemplateColumn.CellTemplate> </sdk:DataGridTemplateColumn> <sdk:DataGridTextColumn Header="Countryname" Width="100" Binding="{Binding Region Name}" CanUserReorder="False"/> <sdk:DataGridTextColumn Header="Populution" Width="80" Binding="{Binding Number Of People}" CanUserReorder="False"/> </sdk:DataGrid.Columns> <sdk:DataGrid.RowDetailsTemplate> <DataTemplate> <sdk:DataGrid x:Name="dgrdRowDetail" Width="400" AutoGenerateColumns="False" HorizontalAlignment="Center" IsReadOnly="True" Grid.Row="1"> <sdk:DataGrid.Columns> <sdk:DataGridTextColumn Header="county" Binding="{Binding CompanyName}"/> <sdk:DataGridTextColumn Header="Number Of People" Binding="{Binding CompanyID}"/> </sdk:DataGrid.Columns> </sdk:DataGrid> </DataTemplate> </sdk:DataGrid.RowDetailsTemplate> </sdk:DataGrid> how to make an button in datagrid expand an collapse where there will be 2 image buttons once user clicks the button the rows under it will expand where there should be an one image button with (- symbol) again user clicks the same row the rows which were expanded should collapse.(+ image button) here i have done the function for doing the expand and collapse is completed. now only i need add an image which will change once the user clicks the row either ( we can do it by javascript or in code behind ?) how can i change the image button like that can any one tell me how i should i ahead or any code that can help me to solve the issue thanks in adance prince

    Read the article

  • Best Practice Method for Including Images in a DataGrid using MVVM

    - by Killercam
    All, I have a WPF DataGrid. This DataGrid shows files ready for compilation and should also show the progress of my compiler as it compiles the files. The format of the DataGrid is Image|File Path|State -----|---------|----- * |C:\AA\BB |Compiled & |F:PP\QQ |Failed > |G:HH\LL |Processing .... The problem is the image column (the *, &, and are for representation only). I have a ResourceDictionary that contains hundreds of vector images as Canvas objects: <ResourceDictionary xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <Canvas x:Key="appbar_acorn" Width="48" Height="48" Clip="F1 M 0,0L 48,0L 48,48L 0,48L 0,0"> <Path Width="22.3248" Height="25.8518" Canvas.Left="13.6757" Canvas.Top="11.4012" Stretch="Fill" Fill="{DynamicResource BlackBrush}" Data="F1 M 16.6309,18.6563C 17.1309,8.15625 29.8809,14.1563 29.8809,14.1563C 30.8809,11.1563 34.1308,11.4063 34.1308,11.4063C 33.5,12 34.6309,13.1563 34.6309,13.1563C 32.1309,13.1562 31.1309,14.9062 31.1309,14.9062C 41.1309,23.9062 32.6309,27.9063 32.6309,27.9062C 24.6309,24.9063 21.1309,22.1562 16.6309,18.6563 Z M 16.6309,19.9063C 21.6309,24.1563 25.1309,26.1562 31.6309,28.6562C 31.6309,28.6562 26.3809,39.1562 18.3809,36.1563C 18.3809,36.1563 18,38 16.3809,36.9063C 15,36 16.3809,34.9063 16.3809,34.9063C 16.3809,34.9063 10.1309,30.9062 16.6309,19.9063 Z "/> </Canvas> </ResourceDictionary> Now, I want to be able to include these in my image column and change them at run-time. I was going to attempt to do this by setting up a property in my View Model that was of type Image and binding this to my View via: <DataGrid.Columns> <DataGridTemplateColumn Header="" Width="SizeToCells" IsReadOnly="True"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <Image Source="{Binding Canvas}"/> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> </DataGrid.Columns> Where in the View Model I have the appropriate property. Now, I was told this is not 'pure' MVVM. I don't fully accept this, but I want to know if there is a better way of doing this. Say, binding to an enum and using a converter to get the image? Any advice would be appreciated.

    Read the article

  • Handling DataGrid.SelectedItems in an MVVM-friendly manner

    - by Laurent Bugnion
    An interesting question from one of the MVVM Light users today: Is there an MVVM-friendly way to get a DataGrid’s SelectedItems into the ViewModel? The issue there is as old as the DataGrid (that’s not very old but still): SelectedItem (singular) is a DependencyProperty and can be databound to a property in the ViewModel. SelectedItems (plural) is not a DependencyProperty. Thankfully the answer is very simple: Use EventToCommand to call a Command in the ViewModel, and pass the SelectedItems collection as parameter. For example, if the command in the ViewModel is declared as follows:public RelayCommand<IList> SelectionChangedCommand { get; private set; }and (in the MainViewModel constructor):SelectionChangedCommand = new RelayCommand<IList>( items => { if (items == null) { NumberOfItemsSelected = 0; return; } NumberOfItemsSelected = items.Count; }); Then the XAML markup becomes:<sdk:DataGrid x:Name="MyDataGrid" ItemsSource="{Binding Items}"> <i:Interaction.Triggers> <i:EventTrigger EventName="SelectionChanged"> <cmd:EventToCommand Command="{Binding SelectionChangedCommand}" CommandParameter="{Binding SelectedItems, ElementName=MyDataGrid}" /> </i:EventTrigger> </i:Interaction.Triggers> </sdk:DataGrid> I slapped a quick sample and published it here (VS2010, SL4 but the concept works in SL3 and WPF too). Cheers! Laurent Laurent Bugnion (GalaSoft) Subscribe | Twitter | Facebook | Flickr | LinkedIn

    Read the article

  • Flash Builder (Flex 4): datagrid populated by XML, how can I add an image in some of the rows?

    - by ufk
    I have a DataGrid table with columns name, phone. In column name I would like to add a picture near the name of the person. How can I add a picture in a datagrid row? <fx:Declarations> <fx:XMLList id="people" xmlns=""> <test> <name>moshe</name> <phone>555</phone> </test> </fx:XMLList> </fx:Declarations> <mx:DataGrid id="dg" color="0x323232" width="532" rowCount="10" top="10" left="10" DataProvider="{people}"> <mx:columns> <mx:DataGridColumn dataField="name" headerText="person name"/> <mx:DataGridColumn dataField="phone" headerText="phone"/> </mx:columns> </mx:DataGrid>

    Read the article

  • Flex: Double click event propagation on datagrid dependent on component order?

    - by MyMacAndMe
    I'd like to have a double click event on a datagrid in Flex3. The following example only works if the Accordion (id = "mustBeSecond") container comes after the DataGrid. Why is the order of the components important and what can I do to prevent this behavior? (The example does not work. If you change the order of "mustBeSecond" and "gridReportConversions" the example works fine) <mx:Script> <![CDATA[ import mx.controls.Alert; import mx.collections.ArrayCollection; [Bindable] private var dp:ArrayCollection = new ArrayCollection([ {qty:1,referer:'http://google.com'}, {qty:25,referer:'http://cnn.com'}, {qty:4,referer:'http:stackoverflow.com'}]); private function refererRowDoubleClicked(e:Event):void { Alert.show("double click"); } ]]> </mx:Script> <mx:HBox width="100%" height="100%"> <mx:Accordion width="200" height="200" id="mustBeSecond"> <mx:Canvas label="Navigation Box" width="100%" height="100%"> <mx:VBox> <mx:LinkButton label="First Link" /> <mx:LinkButton label="Second Link" /> </mx:VBox> </mx:Canvas> </mx:Accordion> <mx:DataGrid id="gridReportConversions" height="100%" width="100%" dataProvider="{this.dp}" mouseEnabled="true" doubleClickEnabled="true" itemDoubleClick="refererRowDoubleClicked(event)"> <mx:columns> <mx:DataGridColumn width="75" dataField="qty" headerText="Qty" /> <mx:DataGridColumn dataField="referer" headerText="URL" /> </mx:columns> </mx:DataGrid> </mx:HBox>

    Read the article

  • How can I know when a Button in a Flex DataGrid itemRenderer is clicked?

    - by Eric Belair
    I have a DataGrid component that displays a few columns of data. It has one additional column that displays a Button that allows the user to take an action with regard to the record. <mx:DataGrid dataProvider="{myData}"> <mx:columns> <mx:DataGridColumn dataField="firstName" headerText="First Name" width="75" /> <mx:DataGridColumn dataField="LastName" headerText=" Last Name" width="150" /> <mx:DataGridColumn dataField="phone" headerText="Phone" width="120" /> <mx:DataGridColumn headerText="" width="110"> <mx:itemRenderer> <mx:Component> <mx:Box horizontalAlign="center" width="100%"> <mx:Button label="Take Action" /> </mx:Box> </mx:Component> </mx:itemRenderer> </mx:DataGridColumn> </mx:columns> </mx:DataGrid> I need to perform an action in the parent component, using other data that is available there, but unrelated to the data in the DataGrid. What is the best way to catch the Button click in the parent component, and know what record it corresponds to? Should I use a Custom Event, or an itemEditor, or something else completely?

    Read the article

  • DataGrid - Edit the selected row when a button is clicked.

    - by Chepech
    Hi all. I have a very simple DataGrid with 2 columns, some thing like this: <mx:DataGrid id="grid" > <mx:columns> <mx:DataGridColumn dataField="name" headerText="Name"/> <mx:DataGridColumn dataField="date" headerText="Date"/> </mx:columns> </mx:DataGrid> What Im trying to do is to activate the edition of the selected row when the user clicks a button. So far I've been unable to find any example of how to do this. I already tried 6 or 7 different approaches but non works. Does any one has a clue how to do this? How do you get the selected row (NOT selectedItem) of a DataGrid and how can you: Change the ItemRenderEditor or ItemRenderer on the fly of just that row. Or enable the edition of that specific row without clicking it. This are the questions that I've been unable to answer Help will be greatly appreciated.

    Read the article

  • How do I programmatically insert rows into a Silverlight DataGrid without binding?

    - by j0rd4n
    I am using a common Silverlight DataGrid to display results from a search. The "schema" of the search can vary from query to query. To accommodate this, I am trying to dynamically populate the DataGrid. I can set explicitly set the columns, but I am having trouble setting the ItemSource. All of the MSDN examples set the ItemSource to a collection with a strong type (e.g. a Custom type with public properties matching the schema). The DataGrid then uses reflection to scour the strong type for public properties that will match the columns. Since my search results are dynamic, I cannot create a strong type to represent what comes back. Can I not just give the DataGrid an arbitrary list of objects so long as the number of objects in each list matches the number of columns? Anyone know if this is possible? I would like to do something similar to this: List<List<object>> myResults = <voodoo that populates the result list> myDataGrid.ItemsSource = myResults;

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >