.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

Data template for Icon in Header of listview on sorting

Posted By:      Posted Date: September 17, 2010    Points: 0   Category :WPF
I have 2 datatemplates that show 2 icons for sorting on ascending and on descending.. <DataTemplate x:Uid="HeaderTemplateArrowDown"> <DockPanel> <TextBlock Text="{Binding}"/> <Path x:Name="arrow" StrokeThickness = "1" Fill = "gray" Data = "M 5,10 L 15,10 L 10,5 L 5,10"/> </DockPanel> </DataTemplate> <DataTemplate x:Uid="HeaderTemplateArrowUp"> <DockPanel> <TextBlock Text="{Binding }"/> <Path x:Name="arrow" StrokeThickness = "1" Fill = "gray" Data = "M 5,5 L 10,10 L 15,5 L 5,5"/> </DockPanel> </DataTemplate> So now how do i use these in my theme file . How do i use them at a time all over my project in multiple forms from my theme file. Like how do i include these datatemplates into the GridViewColumnHeader Style.

View Complete Post

More Related Resource Links

editing the text of a textbox inside the data template of an expander header template


hello I have the following expander




<Expander Grid.Row

edit the text of a textbox inside the data template's header template of an expander


hello I have the following expander




<Expander Grid.Row

Using ASP.NET 3.5's ListView and DataPager Controls: Displaying Data with the ListView

Prior to ASP.NET 3.5, developers who needed to display a set of records could choose between the GridView, DataList, and Repeater controls. The GridView provides rich data features, but has a very boxy layout; the DataList and Repeater allow for a more flexible layout, but lack the "point and click" data features found in the GridView, DetailsView, and FormView controls. The ListView bridges the gap between layout flexibility and built-in data features.

This article, the first in a series of articles on the ListView and DataPager controls, looks at the ListView's many available templates and illustrates how to display data. Read on to learn more!

Sorting Data in a GridView Web Server Control

The GridView control provides built-in sorting functionality without requiring any coding. You can further customize the sort functionality of the GridView control by using custom SortExpression property values for columns as well as by using the Sorting and Sorted events

ListView DataPager with SQL-Statements that already return only paged data.



As far as I understand the ListView-Control and the DataPager-Control, they work like this: The ListView gets its datarows from its data source, then the DataPager causes the ListView to display only a subset of those rows.

So what, when I want to use custom databinding for the ListView, that *already* gets the certain subset from SQL-Server (for better performance). Can I and how can I use the DataPager then?

Thanx, S.

Stop Sorting Cross Tab Report Header


Dear, I want to stop sorting in cross tab report header. And also want to sort in specific order. How can i do that? Please help me. Its urgent


listview 3.5 bind dropdownlists edit item template VB.NET


I am trying to do this with many issues of data binding doubling the amount and not setting selectedValue on dropdownlist. I have read some posts and they help but I am missing a crucial piece. My problem is that my dropdownlist is doubling the amount of records for the dropdownlist. Instead of "YES;NO;SELECT A VALUE", I am getting "YES;NO;SELECT A VALUE;YES;NO;YES;NO". My database is correct with the UPDATE part but the rebind after update is failing horribly.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If IsPostBack Then
            If Session("ACTIVETAB").ToString() = Session("SUBCONTRACTSATABNO").ToString() Then
            End If
        End If
    End Sub

    Public Function loadlookups(ByVal id As String, ByVal e As System.Web.UI.WebControls.ListViewItemEventArgs) As DataTable
        Select Case id
            Case "ddlCertReceived"
                dt = GetLookupTable("SubcontractsA", "Sub 1 Cert Received")
                Dim ddlCertReceived As DropDownList = _
                CType(e.Item.FindControl("ddlCertReceived"), DropDownList)
                ddlCertReceived.DataSource = dt
                ddlCertReceived.DataTextField = "lup_text"

Get the controls from a TabItem's data template

Hello, I am using the following Style on a custom TabItem that I am using: <Style TargetType="{x:Type local:GSFTabItem}"> <Style.Resources> <cmn:EnumDisplayConverter x:Key="Converter" Type="{x:Type crys:GSFOperator}"/> <local:GSFTabVisibilityConverter x:Key="visibility"/> </Style.Resources> <Setter Property="DataContext" Value="{DynamicResource GSFObject}"></Setter> <Setter Property="Header" Value="{Binding Field}"/> <Setter Property="Content" Value="{DynamicResource GSFObject}"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type local:GSFTabItem}"> <Grid> <Border Name="Border" BorderBrush="Black" BorderThickness=".5,.5,.5,0" Background="White" > <StackPanel Orientation="Horizontal"> <Label VerticalAlignment="Center" HorizontalAlignment="Center" Content="{Binding Field}"/> <Label Content="X" IsHitTestVisible="True"

listview with button in item template - how do I handle the click event?

Hello,Using a listview control for the first time... I need a button for each item, and of course I need to handle the click event for the buttons... upon clicking a particular button I of course need to know which item the button is associated with so the appropriate action can be taken...In VS, I can't select the button and see my list of available events in the properties window like is normally done for controls outside of templates like this... what do I need to do?

ListView get data on SelectedIndexChanging

Hi,I have a ListView  with aOnSelectedIndexChanging="ProductsListView_SelectedIndexChanging" and a button action<asp:LinkButton ID="SelectButton" runat="server" Text="SELECT" CommandName="Select" />This works great if i want to get the value on item in the ListView with code behind:   Sub ProductsListView_SelectedIndexChanging(ByVal sender As Object, ByVal e As ListViewSelectEventArgs)         Dim item As ListViewItem = CType(ProductsListView.Items(e.NewSelectedIndex), ListViewItem)        Dim myLabel As Label = CType(item.FindControl("NameLabel"), Label)        Label1.Text = myLabel.Text End SubHowever, I would like to get a value thats not on a control. So I tried this:  Sub ProductsListView_SelectedIndexChanging(ByVal sender As Object, ByVal e As ListViewSelectEventArgs)        Dim dataItem As ListViewDataItem = CType(ProductsListView.Items(e.NewSelectedIndex), ListViewDataItem)      &nb

Sorting ListView in Virtual Mode

Hi,   Can ListView contol be sorted when in Virtual Mode?   Please assist   Thanks

Help Getting ListView To Display Data

I have years of Java experience but am new to .NET development.  I am currently working with C# and Microsoft Visual C# 2008.  Everything has been going well accept for one snag.  I can't get a ListView to display anything.  I've now spent hours on it and it seems I just don't get it.  Below is a sample program of my problem.  I am constructing the ListView in the Form constructor.  It's supposed to have 2 groups with 2 items, but when I run the program, the ListView is empty.  I've played around with trying different view types, but to no avail.  I've reduced it to the bare minimum and still don't get it.  What am I missing? using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace DemoFormApp { public partial class Form1 : Form { public Form1() { InitializeComponent(); ListViewGroup group1 = new ListViewGroup("Group One"); ListViewGroup group2 = new ListViewGroup("Group Two"); ListViewItem item1 = new ListViewItem("ABC"); ListViewItem item2 = new ListViewItem("CD"); group1.Items.Add(item1); group2.Items.Add(item2); listView1.Groups.Add(group1); listView1.Groups.Add(group

Up Down GridView Icon Image for Column Sorting

I'm trying to add an Ascending and Descending sort direction Icon Image next to the header text of my ASP.NET 2.0 Gridview Columns.I've searched and found some examples that seem to do this but have had difficult time recoding them from C# to VB or some just seemed overly complex for what I want to do.Does anyone have a simple VB solution for sort icons?Thanks,Ethan   

Sorting in Data GridView using c#

Sallam & Hi to all,well i m making a project in asp .net c# i used data gridview which is bound at run time after many calculations... problem occured when i want to sort it.. anybody help me...ThanksSaqib

Listview Toggle Visibility of a Textbox based on Data Not Null.

I want to toggle a Textbox to be visible (true, false) contained within an InsertItemTemplate based on the data being Null/Empty.   It Works in the Item Template since it is calling the "select parameters", but once it is in the "insert parameters" on databinds, I am unable to get this to work.  <%# String.IsNullOrEmpty(Convert.ToString(Eval("qu_8")))?Convert.ToBoolean("false"):Convert.ToBoolean("true") %> (works in Item Templates, but not in InsertItemTemplate to toggle a textbox to be visible or not visible). I am using C# in code behind. Thanks in advance -Mark

Alignment of GridViewColumn Header in ListView

I must be missing something really obvious here, but how do I align the content of the header of a GridViewColumn in a ListView?   I tired applying a DataTemplate for the header like so:   <GridViewColumn Header="MyHeader" Width="80" DisplayMemberBinding="{Binding TrDt}">    <GridViewColumn.HeaderTemplate>       <DataTemplate>          <TextBlock Text="{Binding}" HorizontalAlignment="Left"/>       </DataTemplate>    </GridViewColumn.HeaderTemplate> </GridViewColumn>   But the header still comes out center aligned... Any hints?

how to find control from header template of a datalist?

 Hi,I have a textbox in header template of a datalist. From code behind i've to access these textbox from page_load event.I tried with the following code. DataList.Controls[0].FindControl("myControl") But it have error. how to solve it? 
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