I am facing a problem when HorizontalScrollBarVisibility="Visible" OR HorizontalScrollBarVisibility="Auto" of ScrollViewer object is set then Grid column width is not working and giving unexpected result.
Here my control XAML.
<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" xmlns:igGrid="clr-namespace:Infragistics.Silverlight.Controls;assembly=Infragistics.Silverlight.XamWebGrid.v10.1" x:Class="SilverlightApplication3.MainPage" > <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" > <Grid x:Name="LayoutRoot" MinWidth="600" MinHeight="350"> <igGrid:XamWebGrid x:Name="myGrid" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden" AutoGenerateColumns="False" d:LayoutOverrides="Width, Height" Height="110" VerticalAlignment="Top"/> </Grid> </ScrollViewer></UserControl>
and Here is my Code Behind file.
public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); List<CustomClass> lst = new List<CustomClass>(); for (int i = 0; i < 15; i++) { lst.Add(new CustomClass { Name = "Name " + i.ToString(), Val1 = i.ToString(), Val2 = i.ToString() }); } TextColumn tc1 = new TextColumn(); tc1.Key = "Name"; tc1.Width = new ColumnWidth(0.5, true); TextColumn tc2 = new TextColumn(); tc2.Key = "Val1"; tc2.Width = new ColumnWidth(0.25, true); TextColumn tc3 = new TextColumn(); tc3.Key = "Val2"; tc3.Width = new ColumnWidth(0.25, true); myGrid.Columns.Insert(0, tc1); myGrid.Columns.Insert(1, tc2); myGrid.Columns.Insert(2, tc3); myGrid.UpdateLayout(); myGrid.ItemsSource = lst; } } public class CustomClass { public string Name { get; set; } public string Val1 { get; set; } public string Val2 { get; set; } }
Here is the output????
is it a bug in Grid? Kindly reply me soon as I will have to take decision soon. Thanks
Best Regards,
Hi,
If you put the xamGrid into a container that gives the control Infinite Width, then we cannot support star sizing, as its based off the remaining width of the control. Not to mention you'll loose virtualization.
If you must put the xamGrid into a scrollViewer, then you should set a Height and Width on it, so that sizing can be performed like you expect and so that virtualization is on.
-SteveZ
Thank you Steve. One more thing. I need to select Row and Column both at a time in Grid like as in the image.
I set the following property in my Grid
<igGrid:XamWebGrid.SelectionSettings> <igGrid:SelectionSettings CellSelection="None" ColumnSelection="Single" RowSelection="Single" CellClickAction="SelectRow" /> </igGrid:XamWebGrid.SelectionSettings>
but it is either selecting Row OR column....not both at a time? Any help please.
In the future, it would be better to make a new thread for a different question.
However, the only way to select both a row and a column using the default functionality is to hold the ctrl key while selecting a row and a column.
If you need different functionality, where when a user clicks on a cell, that both the row and column become selected, i suppose you could use the ActiveCellChanged event and select the column for the cell that is the new active cell.
Hello SteveZ,
As you said, I have created a new thread for my problem (that how can we select column and Row, both dynamically in code behind). http://community.infragistics.com/forums/p/44812/243461.aspx#243461
Kindly reply me as I will have to complete my demo. Thanks