私の質問は、C#.NET4.0でプログラミングするページフォーム内のDataGridについてです。このアプリケーションはデスクトップ用であり、WebやSilverlight用ではありません。
背景を変更するよりも、ページのDataGridに変更を加えました。残念ながら、行を選択すると、青に変わるだけで(選択されていることを識別する色)、その行の列にのみ影響します。これらのデータグリッドの中には、スペースが残っています。私がする必要があるのは、その空白スペースを含めて、その行を完全に選択することです。
変更されたもう1つの点は、マウスが任意のレコード上にあるときのマウスの動作です。この変更後、この動作は発生しなくなりました。
私が何をする必要があるか手がかりはありますか?
編集:コードの追加:
私のコンバーター:
public class RetornaCorFundoGrid : DependencyObject, IValueConverter
{
public static DependencyProperty CorFundoGridParameterProperty =
DependencyProperty.Register("CorFundoGridParameter", typeof(IEnumerable<Object>), typeof(RetornaCorFundoGrid));
public IEnumerable<Object> CorFundoGridParameter
{
get { return ((IEnumerable<Object>)GetValue(CorFundoGridParameterProperty)); }
set { SetValue(CorFundoGridParameterProperty, value); }
}
public object Convert(Object value, Type targetType, object parameter, CultureInfo culture)
{
try
{
if (System.Convert.ToInt16(value) < 5)
return Brushes.BlueViolet;
if (System.Convert.ToInt16(value) < 15)
return Brushes.CadetBlue;
else
return Brushes.Coral;
}
catch (Exception)
{
return Brushes.Black;
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
私のバインディングリフレクター:
<ut:BindingReflector Target="{Binding Mode=OneWayToSource, Source = {StaticResource RetornaCorFundoGrid}, Path=CorFundoGridParameter}"
Source="{Binding Parameters, Mode=OneWay}" />
私の列のスタイル:
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="Background" Value="{Binding Path=Id, Converter={StaticResource RetornaCorFundoGrid}}"/>
</Style>
</DataGrid.RowStyle>