.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Grid Inside StackPanel Sizing Issue

Posted By:      Posted Date: October 22, 2010    Points: 0   Category :WPF

Hello All,


  I'm fairly new to WPF and I'm having an issue with a layout I'm trying to accomplish. I have pasted the XAML below. Briefly I have a Grid inside a stackpanel in which the grid has 3 stack panels nested below. The Grid in question is Named DetailGrid, which is not sizing correctly. In fact it's not stretching at all and is causing issues with some drag and drop functionality.The layout I'm trying to achieve is a Header/Body layout, where the header remains the same and the body is dynamic content based upon objects the user chooses to place on the detail grid/stackpanels. I know this may not be the best choice of controls for this layout, but the functionality of having all the children contrlols move dynamically when the expanders are expanded and collapsed is a desired function of the application.

Any Recommendations are greatly appreciated.


<Window x:Class="AtlasConsole.ConsoleHeader"

View Complete Post

More Related Resource Links

Repeater issue, all code inside Repeater are not shown


I have a Repeater who should show some data from my ms.sql server. But all code inside the Repater is not shown on my .aspx page. What am i doing wrong. I have a similar Repeater on another page and there it works fine.


 <div class="AnsaettelseKontrakt Folders">
      	            <table cellpadding="0" cellspacing="0" width="750px" align="right">
                            <th class="BrugerHeader" style="width:300px;">Filnavn</th>
                            <th class="BrugerHeader" style="width:80px;">Størrelse</th>
                            <th class="BrugerHeader" style="width:150px;">Dato</th>
                            <th class="BrugerHeader" style="width:180px;" colspan="2">Brugere</th>
                            <th class="BrugerHeader" style="width:40px;">Værktøjer</th>
                        <asp:Repeater ID="RepeaterAns" runat="server" onitemcommand="Repeater1_ItemCommand" >
                                <tr class="Br

Datalist with embedded Grid or List...Sub Totals issue with iteration


Let me see if one of you can assist with this one...


i have a similar situation, but mine does not use the selected item (item Command). Here is what the form is to do:


1. this is for an educational environment, so we use SID- NOT SSN's, but i use the SID as a filter in the subset as the grouping unique id.

2. I'm trying to inject a sub total row at the last line item of each SID (if more than one item in the report for that SID).

3. I'm looping thru the items in the Datalist Item Command with a for each (item i in Datalist2.Items).

Image stretch inside a grid stops working horizontally once columns are added to grid.

I have a simple setup of a window. Window contains a grid, inside the grid there is an image. I want the image to always stretch across the entire cell. I've set it's Stretch property to Fill and it works fine, as long there is only one column in the parent grid. As the window is resized, the image stretches correctly. As soon as I add another column, the image stops stretching horizontally. Vertially it works just like before, horizontally it now appears with a fixed width corresponding to the width of the picture used as the source. Does not matter which column it's positioned in, and I've tried encapsulating it into another grid but behaviour does not change. It behaves the same in both Visual studio 2010 designer and at runtime. In addition when I tried to encapsulate it in a second grid, this seond grid also now has altered behavior - instead of sizing itself to it's container (both height and width are not set) as it's parent grid does, it now sizes itself to its contents - the image. But only horizontally. What is going wrong here, is this a bug or am I missing something, and any advice on how I can get the image to fill one of the cells of a grid with more then one column?

delete using boung field value inside grid view

I want to delete data using boung field value inside grid view, I am doing this...but it is not finding bound field value<asp:BoundField DataField="nsid" HeaderText="nsid" SortExpression="nsid" Visible="false" />protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)    {        string sid = GridView1.DataKeys[e.RowIndex]["nsid"].ToString();        SqlCommand cmdx = new SqlCommand("delete from blogreply where sid='"+sid+"'",con);        con.Open();        cmdx.ExecuteNonQuery();        con.Close();please anyone tell me how to find bound field value..

To get/set value for combo which is inside a grid

 I have a winform (.NET 3.5) that I am working on. On button click I want to be able to get/set selected value for combo which is placed inside the grid Regards, Sushant

Custom grid view issue


    In the first place i want to mention that i am a beginner in visual studio and sql server. So, i have this project to make but i have this problem with the grid view. For this pr_ojects i have to make 3 tables with the next configurations: tbl_lines - ID, NameP, Ord ; tbl_columns - ID, NameProp, Ord ; tbl_Content - ID, Line_ID, Column_ID, Text.

    The final grid must be something like that:   

grid view final

      I have managed to make a database and merge the tables but i do not know how to make P1, P2 data to be displayed horizontally. Any ideeas? Please take me easy!... 

HELP ! - how to disable spesific control inside the grid view



I need to disable the "Imagebuttons" after the user click on one of them... I've sucessfully updated the table when the user click on a button using the following code on the event of row command of the gridview...


if (e.CommandName == "voter_up")
            SqlCommand voteup = new SqlCommand("update arto_comments set voteup = voteup+1 where cid=" + e.CommandArgument, con);
            SqlCommand getVup = new SqlCommand("select voteup from arto_comments where cid =" + e.CommandArgument, con);
            //lblvoteup.Text = Convert.ToString(getVup.ExecuteScalar());
            //GridView1.Rows[1].FindControl("ImageButton1"). = false;
            ImageButton1.Enabled = false;

so please how may I disable these buttons after database is updated ?

Thanx and Regards

Issue with webparts inside usercontrol


Iam using an usercontrol with webparts added to it.

In some specific scenarios i need to load the same user control multiple times.

Its not allowing to add more that one time showing up the error message webpart zone-id already added.

If am using that usercontrol without webparts iam able to add multiple times with out any error message.

How can i resolve this issue with webparts .

Please help me out

Combobox inside Listbox binding issue

I am lost...

I have the following two classes (simplified)

Class Parent
    String Description{get;set;} 
    ObservableCollection<Children> ListOfChildren = new ObservableCollection<Children>();

Class Children
    public string Name{get;set;}

And the following two lists :

public List<Parent> ListOfParents = new List<Parent>();
public static List<Children> StaticListOfChildren=new List<Children>();

Now I have a list in XAML, I set the datacontext of this list to the "ListOfParents" (in code) and set the ItemSource="{Binding}"
All works fine so far. Inside this list I have another list containing the "ListOfChildren" list. The itemtemplate of this list contains a combobox. This combobox binds to the "StaticListOfChildren" list. The problem is now I can't get the selecteditem of the combobox to bind to the Children item in the ListOfChildren.... Can anyone help ??

<ListBox x:Name="lbMaterialsBuildup" HorizontalContentAlignment="Stretch" ItemsSource="{Binding}">

Accessing the different controls inside a GridView control

how we can access a particular control which resides inside a GridView control. In this article I will show you how you can access different controls inside a GridView control. We will see how we can access a TextBox control, a DropDownList control and a ListBox control. If you are working with ASP.NET 1.X then you might want to check out my article Accessing Different Controls Inside a DataGrid.

Building a grouping Grid with GridView and ASP.NET AJAX toolkit CollapsiblePanel

I've posted an update to this post to apply on demand loading of Details data using ASP.NET AJAX PageMethods. I'm demonstrating the usage if CollapsiblePanelExtender client events on the new post. Check it out.

I admit, Matt Berseth is really inspiring me! Few days ago I pass through 2 of his great posts:

.Surrounding your Data Table and Dialog Controls with ComponentArt Styled Panels
.Building a Grouping Grid with the ASP.NET 3.5 LinqDataSource and ListView Controls
The first one is pure design tips one which I used for making good presentation of my demo here. The 2nd post is actually the idea.

How To Add calendar control inside a GridView

This article show hot to add calendar control inside a GridView with code in c#

Using ATLAS PopUp Control with Calendar inside the GridView Control

In this video tutorial Mohammad demonstrates how you can access the Calendar control which is displayed using the ATLAS PopUp control inside the GridView control.

RadioButton inside GridView, How to get it work as normal

Did you tried before to drag a RadioButton control inside a Gridivew templatefield, and then you attempt to select these RadioButtons , you will notice that the behavior of RadioButton control will be changed and it will work just like the behavior of checkbox control! the user will be able to select more than one radiobutton in the grid!

Maintain HTML Radio Button Selection Inside GridView After Postback

Long time ago I wrote an article about getting the value of the selected RadioButtons inside the GridView control. The code did not addresssed the postback issue which means that the selected radio button was cleared after the postback occurs.

jQuery grid view plugin

jqGridView is new, client-rich, XML-based, ajax grid plugin for jQuery library. jqGridView provides professional solution for representing and editing tabular data on the web. Carefully designed, with powerful script API, this editable DHTML grid is easy configurable with XML, and shows convincing results working with large amounts of data. jqGridView allows easy implementation of nice looking(managed through css). jqGridView is not platform-depending plug-in, it can be used with different web -programming platforms like: ASP .NET/ASP, PHP, JAVA, CGI scripts etc. jqGridView has hight bowser compatibility.

jQuery grid view plugin

jqGridView is new, client-rich, XML-based, ajax grid plugin for jQuery library. jqGridView provides professional solution for representing and editing tabular data on the web. Carefully designed, with powerful script API, this editable DHTML grid is easy configurable with XML, and shows convincing results working with large amounts of data. jqGridView allows easy implementation of nice looking(managed through css
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend