Programmatically create table with clickable and expandable content in WPF - c#

This is what I desire to create:
As you see I need to create table like control with images and clickable cells. When you click on an arrow on the left it expands its' content and content contains some more additional table like controls with data. Also when user clicks on a Star I need to add this event to Favorites list and etc.
Currently, for each data row I'm thinking of programmatically creating accordion item with Grid in header for images and cells and other Grids for the content.
What is the best and easier way to achieve this task? What controls should I use? I need some suggestions, as I'm new to WPF.

WPF DataGrid can show RowDetails. Customize them with RowDetailsTemplate property and manage their visibility with RowDetailsVisibilityMode property

Related

Multiple UI for a single ListBox in Wp8

I have a listbox in the xaml page.I have created three tabs(Normal text boxes) on the top.If clicked on tab 1 or tab 2,it displays an expander view in the listbox as its item.I want to create a simple listbox for the 3rd tab,i.e, no expander view.Is it possible in wp8?
I not sure that I understand your question, but I think that you could use a Pivot control to achieve the results you want to get.
Using a Pivot, you could get different "tabs" and each tab could have his own controls. Hope this helps

Adding dynamic content to a Data Grid in a dynamically created Tab

In C# WPF MVVM I have implemented a TabControl with observable collection and every time I click a certain button, a new tab is created. Inside every tab I want to have a data grid, so I added a data grind into a TabControl.ContentTemplate. Now I want to fill the data grid dynamically. Depending on which tab the data grid is in, I want to bind its ItemsSource to a certain list. So every tab has a data grid with a list of elements, but these elements are different depending on which tab the data grid is in. How can I make this binding?
I thought about extending the TabItem with a list of elements I want data grid to contain, but I do not know how to access the TabItem to which a specific data grid belongs to using XAML.
How can this be done?
I ended up adding a new UserControl and a corresponding ViewModel for it, and then added the crated user control inside the DataTemplate tag.

How to make a DataGrid cell template that is larger than the cell but fully visible

In the .Net 4.0 WPF Datagrid, the edit mode of a DataGridComboBoxColumn pops up the ComboBox drop-down in a size that is not dependent on the size of the cell containing the data.
I am building a template for a cell that is somewhat like a combobox, but has features like multi-select, other controls as collaborating neighbors, etc. My editor is working nicely, except for one issue.
I've been trying to figure out how to make the editor appear in front of the DataGridCell that is being edited, and not limited to the current size of that cell, so that the control can be large enough to present content and behaviors nicely to the user. This is similar to what the drop-down of the combobox cell does in WPF data grid.
Can anyone tell me how to do that?
Thanks in advance...
ComboBoxes use Popups, you could put your control in one (presumably only when editing -> Put one in the CellEditingTemplate).

WPF DataGrid - Dynamic Row Details via Code

I have the need to show RowDetails in the WPF DataGrid when the user performs an action outside of the grid. The thing is though, I need to be able to switch out exactly what the RowDetails will be based on that. For example, if the click Add, I want to show RowDetails below Row of type AddRowDetailControl, and if they choose Edit, I would want to show a different control under the same row instead. Is this possible?
You'll have to create the datatemplate of your RowDetails dynamically based on what your requirement is. Inside the datatemplate you can put the controls you need.
Have a look here:
http://www.codeproject.com/KB/WPF/WPFDataGridExamples.aspx

adding a control to tabs generated dynamically in tabcontrol in C# .net

I am new to C# .NET.
Can some one help me out with the below problem:
I have a TabControl in my WindowsForm application, where the tab pages are generated dynamically. The content to be displayed on each tab would be fetched from my database. I need some kind of control (which can display the fetched data) that I can add on each tab page (which would be same for all tabs) such that I can associate some kind of event, say click, on that added control.
Can anyone tell me how to do this programmatically & write the click event for all the controls added?
Please refer the below link! You will get more detail in this regard.
Creating a tab control with a dynamic number of tabs in Visual Studio C#
I'm not sure I completely understand your problem but my initial thoughts are that you could dynamically create a datagrid or something similar for each tab that you are dynmically creating. You could then bind the datasource for the grid and then add the grid as a control to your tabpage.
Something like...
DataGridView gv = new DataGridView();
gv.DataSource = //whatever your source is
this.tabPage1.Controls.Add(gv);
You would then have all the events associated with the grid to work with.
I'm thinking data binding is going to be your best bet for displaying this information. You can create a list of objects and use a DataTemplate to format the data. You can apply the DataTemplate to a quite a few objects. I generally use the ItemsControl and ListBox
http://msdn.microsoft.com/en-us/library/ms750612.aspx
good luck

Categories

Resources