.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

A layout, mouse selection, ListView problem/question

Posted By:      Posted Date: August 29, 2010    Points: 0   Category :WPF
I'm having a problem with a particular layout scenario, and how it interacts with a left mouse click in certain situations. I have 3 rows in a Grid.  The first is a ListView (Master), with the Row Height set to '*'. It's ItemSource is bound to a collection in a ViewModel, and its SelectedItem is bound to a value in the ViewModel.  When the SelectedItem is null, it should take up its entire container (the other 2 rows are invisible). The second row is the GridSplitter.  It's visibility is bound to a value in the ViewModel.  It's only visible when the SelectedItem in the Master ListView is not null.  It's GridRow height is set to Auto, and it's height is explicitly set to 5 (via a style). The third row is a sub-ListView that shows Detail data for the Master SelectedItem in the top ListView.  It's GridRow Height is set to zero by default, and if an item is selected in the Master ListView, it should become visible and have a set height (400 to start, via a binding on the Height of the row). The desired effect is that when an item is selected in the Master ListView, the Detail ListView becomes visible and the GridSplitter allows you to resize the top and bottom as needed.  If necessary, the ScrollBars become visible in the Master ListView to show any items that are now obscured by the Detail ListView (via the automatic scrolling featur

View Complete Post

More Related Resource Links

Problem with listview selection

I have the following problem (which I have seen documented in many places with no solution).  I populate a listview.  The steps I use are: Set the ItemsSource to nothing (VB) Set the ItemsSource to the collection to be bound to Set the selected item to nothing (VB) Set the selected item to the first item in the collection The problem is that when I use the down arrow key to change selection in the listview, the first time I use the down arrow nothing happens.  After that first glitch everything works.  I have seen many "solutions" but none that work. Any ideas?? Thanks LLoyd Sheen

Gridview Enable Selection Problem



I have a gridview with Enable selection and Enable Paging equals to TRUE.

I also set the PageSize of my gridview to 4 so that I only displays 4 rows per page.

The problem is when I click the pager in the bottom of my gridview, my gridview is disappearing and no records appear.

Here is code behind of my gridview:

If e.Row.RowType = DataControlRowType.DataRow Then
                e.Row.Attributes("style") = "cursor:pointer"

                e.Row.Cells(2).Attributes.Add("onclick", Page.ClientScript.GetPostBackEventReference(sender, "Select$" & e.Row.RowIndex.ToString))
                e.Row.Cells(3).Attributes.Add("onclick", Page.ClientScript.GetPostBackEventReference(sender, "Select$" & e.Row.RowIndex.ToString))
                e.Row.Cells(4).Attributes.Add("onclick", Page.ClientScript.GetPostBackEventReference(sender, "Select$" & e.Row.RowIndex.ToString))
                e.Row.Cells(5).Attributes.Add("onclick", Page.ClientScript.GetPostBackEventReference(sender, "Select$" & e.Row.RowIndex.ToString))
                e.Row.Cells(6).Attributes.Add("onclick", Page.ClientScript.GetPostBackEventReference(sender, "Select$" & e.Row.RowIndex.ToString))

Crystal Reports can grow fields with large amounts of text layout problem


A can grow field in the details section of a crystal report may have so much text that the section will be larger than the remaining space available on the page (the space below the previous record).  The section has vertical lines on it with Extend to bottom of section when printing set to true.  The section starts on a new page (and may continue on the following one).  I want it to start on the page where the last record was laid out, and continue to the new page without leaving a gap with vertical lines on it.  I'm using Crystal Reports 9 and I can't work out how to do it. Has anyone got a solution?

Nested listview fk-problem with insert



My problem is this, i have a nested listview that works fine but if i need to do an insert and the nested listview dont have retrived any values (that is no posts created) i cant get hold of the fk that i need. If i put a hiddenfield in the parents listview with the fk how can i find it in codebehind when i do an insert? 



Owner-drawn ListView and nonstandard subitem size: selection problems.

Hello, I have a ListView whose first column is owner-drawn and items can be selected (I had to jump through hoops to draw the focus rectangle correctly). The problem is, my custom drawing displays the text in a wider font than normal, and only for this column. And when I click an item to select it, the right part of the text does not react, because the listview doesn't "know" there is text there (since it "thinks" the text is smaller). How can I correct this? Is there a "hit test" or "measure item" event or something, to tell the list view to consider a wider zone for clicks?

CSS Layout Problem when height is fixed to 100%

Hi all,I'm using 3 column DIV layouts for my aspx page which i downloaded it from james tyler website.My problem is when i set height of all the div layers to some 750px it is looking good and when i remove the height, all the DIV layers are getting shortened and looking awakward.I mean if the left menu DIV contains only 3 items, the whole div's height is being reduced to fit those only 3 menu items. I need to maintain 100% height for all DIV layers and my DOCTYPE is XHTML1.0 STRICT. Can anyone please help me out as i'm stuck here.. Here is my CSS and Markup:/* Header styles */ #header { clear:both; float:left; width:100%; } #header { border-bottom:1px solid #57B6DD; } #header p, #header h1, #header h2 { padding:.4em 15px 0 15px; margin:0; } #header ul { clear:left; float:left; width:100%; list-style:none; margin:10px 0 0 0; padding:0; } #header ul li { display:inline; list-style:none; margin:0; padding:0; } #header ul li a { display:block; float:left; margin:0 0 0 1px; padding:3px 10px; text-align:center; background:#eee; color:#000; text-decoration:none; position:relative; left:15px; line-height:1.3em; } #header ul li a:hover { background:#369; color:#fff; } #header ul li a.active, #header ul li a.active:hover { color:#fff; background:#000; font-weight:bold; } #header ul li a span { display:block; } /* 'widths' sub menu */

ListBox/ListView Selection

We are implementing drag/drop on ListBox/ListView items with the extended selection mode. The extended selection mode allows multiple items to be selection simultaneously by holding the shift or control key while selecting additional items.   In Windows Explorer, when an individual item among a group of selected items is clicked, all of the other items are not deselected until the up-click event. This allows an individual to select the desired group and then click and drag this group as a whole to the desired destination.   In WPF, the group appears to be deselected and the individual item selected on the down-click event. This means that in order to drag a group of items, you must hold shift, click and hold the mouse on the desired range of items and then drag the group. If the group is selected first and then the mouse released, the individually clicked item is selected when a drag attempt is made on the group.   We are using WPF, but would like to see the Windows Explorer selection functionality. Any thoughts on how to reconcile these two implementations? The most straight forward fix would be a custom control, possibly derived from ListBox/ListView, but this seems like it might be reinventing the wheel. Seems like the WPF controls are not designed properly here.   Thanks.

Retaining the selection color(default blue Color) for the selected items in ListView when focus is l

I am having a Listview in a form. I have added items(images) to the Listview. When i select the item(Image) in the listview , the item(image) is selected with Default selection Color(Blue). In the same form i have other form added to its container.When i tried to click on the controls of other form, the default selection color(blue) is changing to Grey color. For the lisview i am using property HideSelection = false. How i could maintain the default selection color(blue) even in focus leave of listview? Can any one please suggest me a solution or give me a piece of code. Thanks in Advance, Kumar

Problem with ListView and SelectionMode="Single"

  I have the following XAML: <Grid>       <ListView SelectionMode="Single" Height="100" HorizontalAlignment="Left" Margin="26,118,0,0" Name="listBox1" VerticalAlignment="Top" Width="120">       <ListView.View>       <GridView>       <GridViewColumn Header="Test"/>       </GridView>       </ListView.View>       <ListViewItem>Test</ListViewItem>       <ListViewItem>Test</ListViewItem>       <ListViewItem>Test</ListViewItem>       <ListViewItem>Test</ListViewItem>       <ListViewItem>Test</ListViewItem>       <ListViewItem>Test</ListViewItem>       <ListViewItem>Test</ListViewItem>       </ListView>       </Grid>       Just a stock ListView with SelectionMode="Single". Isn't SelectionMode="Single" supposed to be single selection mode? There seems to be a lot of weird stuff with the Ctrl-Key. I tested the same behavior in a standard W

Can't access a control in a listview layout template with codebehind

While running ItemDetabound upon load of a listivew, I am trying to access the text in a label of the LayoutTemplate of a different Listview.  It works fine if I try access the same labels under the same names if they are in the same listview, but not if they are in a different one.  It was working for a while, can't figure out what I changed, but now says that object doesn't exist.   Here is the html code for the labels: <LayoutTemplate> <table ID="Table2" runat="server" cellpadding="0" cellspacing="0"> <tr ID="Tr1" runat="server" style="padding-left: 0px"> <th ID="Th1" runat="server" style="text-align: left; white-space:nowrap; "> <asp:Label ID="Label1" runat="server">Label 1</asp:Label> </th> <th ID="Th2" runat="server" style="white-space:nowrap; width: 150px" >

MDX problem: Return the number of days in a given selection/range

I've had this problem for a couple of days and found some "solutions" online. However, none of them worked. The goal is to calculate Inventory Turnover, but the problem is I can't seem to return the current number of days in the selection. The solution I found was: Count(Descendants([Date].[Date Hierachy], [Date].[Date Hierachy].[Date])) Which returned this: http://www.jandd.be/images/q_return.jpg However, I just want it to return the number of days that are in the selection, so the number of days between (incl) 22/08 and 25/09. This is a screenshot of my datedim, if it helps: http://www.jandd.be/images/q_datedim.jpg I can imagine this could be real simple or some setting that I didn't find on the dimensions, but it would be really appreciated if I could find a solution like this...

.RDLC report layout...huge problem!!

 Hi!I'm designing a layout for a report in VS2008 using SSRS/RDLC format. And every time I setup a part of that report i test it on my workstation to see if everything is ok. But, today, i finished the first page of that report and uploaded it to my hosting server (were it's going to be used), and when i press the button to convert the report to .pdf and download it the layout is completely ruined :-/When i do the same thing in my workstation every thing 'comes out' beautifully, but up on the server it doesn't :(Why is that happening? Can anyone help me?

checkbox in listview layout template check select all checkboxes in listview itemtemplate

hi,how to do this when the checkbox in listview layout template check select all checkboxes in  listview itemtemplate.I dont give 'Eval 'field to checkbox present in itemtemplate.pls reply me.Many thanks in advance.

Need help to solve header selection problem in accordion

Hello  friends I have created Accordion control from database. so basically in the header section I have bind categories and in the panel Bind subcategories. basically now it's working fine. but the important thing what i have to do is if i selected a category on that time it's showing me subcategory in the accordion. but at the same time i have to show subcategory  on another page.As well as i have to keep selected header true. Now not getting how to show subcategory on another page and as well as how to keep selected header true.Please HElp me solve this issue.Thanks And RegardsOmkar.

Retaining the selection color(default blue Color) for the selected items in ListView when focus is l

I am having a Listview in a form. I have added items(images) to the Listview. When i select the item(Image) in the listview , the item(image) is selected with Default selection Color(Blue). In the same form i have other form added to its container.When i tried to click on the controls of other form, the default selection color(blue) is changing to Grey color. For the lisview i am using property HideSelection = false. How i could maintain the default selection color(blue) even in focus leave of listview? Can any one please suggest me a solution or give me a piece of code. Thanks in Advance, mskumar.mcp

Listview WebPart Selectedview problem

We have a problem with the Listview WebPart on our current project.Situation:We are building custom sitedefinitions for a portal site. In these site definition we add our webpart/features that have to be deployed with this sitedefinition.In that defintion (ONET.xml) we add a ListViewWebPart on the page. <View List="Whiteboard" BaseViewID="3" WebPartZoneID="Left" WebPartOrder="2"    Type="108" /> Sofar everything is going fine, we generate our webs with the definition and the webpart renders like it should on the page.We then add an item in the list (Discussion list). Again sofar everything fine. when we then try to click on the item to view it in the webpart the item seems to magically disappear from within the webpart. However the items stays in the list so it's not like it gets deleted.After some searching we found out that when we bind the selectedview on the webpart again (modify shared webpart -> selected view) the item reappears just as magically as it disappeared.The problem is that for our project we have to create more then 90 webs with this sitedefinition and it's not an option manually start clicking every web for this "bug".Whe tried two other ways to solve this problem without success.First way was to remove the listviewwebpart declaration from the ONET and add the webpart with C# code in

membership provider with custom login form problem / question

Hi all, I am using the .net membership provider, and I can get past the membership.validate user ok and into my secure page.   The problem I have is that when I reach the secured page, I have a login status control which isn't changing from login to logout.   Below is my login code:If Membership.ValidateUser(txtUsername.Text, txtPassword.Text) Then Response.Redirect("/auth/Default.aspx") If chkRememberMe.Checked Then FormsAuthentication.SetAuthCookie(txtUsername.Text, True) Else FormsAuthentication.SetAuthCookie(txtUsername.Text, False) End If Else lblLoginStatus.Text = "Oops! Login not found!" End If    Thanks in advance.
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