Home Forums WPF controls Xceed DataGrid for WPF Listview DataGrid

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #22104 |

    I have a ListView with 4 Columnheaders “User,Cam,Audio and UserStatus” right now i’m trying to get the User column to update as a new person joins the chat box. The information coming in is via String so i’m not sure how to take that String (User that joined). Put it under the Related ColumnHeader “User” i’m not to use to working with ListViews/DataGrids.

    Here is what i have Xaml Side and C# Side::

    <ListView Margin=”3,0,124.688,5″ x:Name=”userLB” Background=”#FF000000″ IsSynchronizedWithCurrentItem=”True” Grid.RowSpan=”2″ Foreground=”#FFFFFFFF” Grid.Column=”4″ Grid.ColumnSpan=”4″ BorderThickness=”2,2,2,2″ Grid.Row=”0″>
    <ListView.BorderBrush>
    <LinearGradientBrush EndPoint=”0.5,1″ StartPoint=”0.5,0″>
    <GradientStop Color=”#FFF5C0C0″ Offset=”0″/>
    <GradientStop Color=”#FF9C5E5E” Offset=”0″/>
    <GradientStop Color=”#FF2D0000″ Offset=”1″/>
    <GradientStop Color=”#FF9F0000″ Offset=”0.7″/>
    <GradientStop Color=”#FFE21F1F” Offset=”0.85″/>
    <GradientStop Color=”#FFFF6161″ Offset=”0″/>
    <GradientStop Color=”#FFFF4848″ Offset=”1″/>
    <GradientStop Color=”#FFFA5555″ Offset=”0″/>
    <GradientStop Color=”#FFFF4F4F” Offset=”0″/>
    <GradientStop Color=”#FFFD4F4F” Offset=”0.995″/>
    </LinearGradientBrush>
    </ListView.BorderBrush>
    <ListView.View>
    <GridView>
    <GridViewColumn Header=”User” DisplayMemberBinding=”{Binding Path=User}” Width=”130″/>
    <GridViewColumn Header=”Cam” DisplayMemberBinding=”{Binding Path=Cam}” Width=”80″/>
    <GridViewColumn Header=”Voice” DisplayMemberBinding=”{Binding Path=Voice}” Width=”80″/>
    <GridViewColumn Header=”User Status” DisplayMemberBinding=”{Binding Path=User Status}” Width=”80″/>
    </GridView>
    </ListView.View>
    </ListView>

    ————————————————————————————–
    The Code below starting with int nameLength = str.IndexOf(“]”, 6); etc is what i’m trying to add to a Column for the ColumnHeader “User”
    *** C# Side ***

    public delegate void delUpdateHistory(string str);
    public void UpdateHistory(string str)
    {
    Window2 w2 = new Window2();
    if (str.StartsWith(“[Join]”))
    {
    int nameLength = str.IndexOf(“]”, 6);
    userLB.Items.Add(str.Substring(7, nameLength – 7));
    return;
    }
    else if (str.StartsWith(“[Left]”))
    {
    int nameLength = str.IndexOf(“]”, 6);
    try
    {
    userLB.Items.RemoveAt(userLB.Items.IndexOf(str.Substring(7, nameLength – 7)));
    }
    catch (Exception ex)
    {
    }
    return;
    }
    else if (str.StartsWith(“[Usrs]”))
    {
    string[] users = str.Substring(7, str.Length – 8).Split(‘,’);
    userLB.Items.Clear();
    foreach (string user in users)
    {
    userLB.Items.Add(user);
    }
    userLB.Items.RemoveAt(userLB.Items.Count – 1);
    return;
    }

    Imported from legacy forums. Posted by Gerry (had 4980 views)

    Odi [Xceed]
    Spectator
    Post count: 426

    Your question seems to be about the ListView control – but that’s not an Xceed control, we don’t provide support for Microsoft’s controls. This forum is for questions and discussions relating to Xceed DataGrid for WPF. Is this a misunderstanding?

    Imported from legacy forums. Posted by Odi [Xceed] (had 345 views)

    User (Old forums)
    Member
    Post count: 23064

    Let me clarify..:)

    I want to replace ListView with a DataGrid that has the same Functionality as the ListView. I have looked at the Examples and they seem to be similar being able to list information Horizontally.

    ColumnHeaders with the Related Data under it..

    ColumnHeader “User” than the column with the username.

    ColumnHeader “Cam” with a Cam image

    etc etc

    Imported from legacy forums. Posted by Gerry (had 383 views)

    Xceed Support
    Member
    Post count: 5658

    I am uncertain of exactly what you ask?

    For details on how to create columns and bind to a data source using the DataGridControl, you can refer to the Xceed DataGrid for WPF documentation, located at:

    http://doc.xceedsoft.com/products/XceedWpfDataGrid/

    There are topics in the Basic Concepts and Advanced Concepts that could help you understand how to use the DataGridControl.

    In addition, there are the “How-To Topics”, under the Class reference section that could help you finding the information you need.

    If I misunderstood your question, can you provide some more details on what it is you have troubles with?

    Imported from legacy forums. Posted by Marcus [Xceed] (had 288 views)

    User (Old forums)
    Member
    Post count: 23064

    I have looked threw the examples in the How to Topics and the Examples that come with the Free DataGrid.

    But need some help creating ColumnHeaders and a Row for each ColumnHeader thats what i’m asking 🙂 I have looked threw everything and dont know where to start with this control,so i need some Help. I need 4 ColumnHeaders::

    Users,Cam,Voice & UserStatus

    Users = String

    Cam = Image

    Voice = Image

    UserStatus = String

    Example from my C# Code is for a ListBox that puts the User’s name in the ListBox when a User joins the Chatroom. But I want to use a DataGrid and have it Update the a ColumnHeader (User) with the persons “username” etc

    public delegate void delUpdateHistory(string str);
    public void UpdateHistory(string str)
    {

    if (str.StartsWith(“[Join]”))
    {
    int nameLength = str.IndexOf(“]”, 6);
    userLB.Items.Add(str.Substring(7, nameLength – 7));

    return;
    }
    else if (str.StartsWith(“[Left]”))
    {
    int nameLength = str.IndexOf(“]”, 6);
    try
    {
    userLB.Items.RemoveAt(userLB.Items.IndexOf(str.Substring(7, nameLength – 7)));
    }
    catch (Exception ex)
    {
    }
    return;
    }
    else if (str.StartsWith(“[Usrs]”))
    {
    string[] users = str.Substring(7, str.Length – 8).Split(‘,’);
    userLB.Items.Clear();
    foreach (string user in users)
    {
    userLB.Items.Add(user);
    }
    userLB.Items.RemoveAt(userLB.Items.Count – 1);
    return;
    }
    }

    Imported from legacy forums. Posted by Gerry (had 369 views)

    User (Old forums)
    Member
    Post count: 23064

    Ok this is what i have come up with for your guys control,Only thats bugging me is this box in a gradient Brown saying ” Drag a column header here to group by that column” how do i remove that thing?? and move onto Theming what i have so far???

    <xcdg:DataGridControl Margin=”141.784,0,124.688,8″ Background=”#FFFFFFFF” d:LayoutOverrides=”Margin” x:Name=”userLB” Grid.ColumnSpan=”2″ Grid.RowSpan=”2″>

    <xcdg:DataGridControl.Columns>
    <xcdg:Column FieldName=”User”
    Title=”User”
    MinWidth=”100″
    MaxWidth=”100″/>
    <xcdg:Column FieldName=”Cam”
    Title=”Cam”
    MinWidth=”50″
    MaxWidth=”50″/>
    <xcdg:Column FieldName=”Voice”
    Title=”Voice”
    MinWidth=”50″
    MaxWidth=”50″/>
    <xcdg:Column FieldName=”User Status”
    Title=”UserStatus”
    MinWidth=”100″
    MaxWidth=”100″/>
    </xcdg:DataGridControl.Columns>
    <GridViewColumnHeader Width=”100″ Height=”100″ Content=”GridViewColumnHeader”/>
    </xcdg:DataGridControl>

    Imported from legacy forums. Posted by Gerry (had 445 views)

    Xceed Support
    Member
    Post count: 5658

    Refer to this thread for follow-up:

    <a href=”http://forums.xceed.com/forums/ShowPost.aspx?PostID=6076″>http://forums.xceed.com/forums/ShowPost.aspx?PostID=6076</a&gt;

    Imported from legacy forums. Posted by Marcus [Xceed] (had 5985 views)

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.