Infragistics CellValuePresenter

바위게·2024년 6월 21일

WPF

목록 보기
7/8

<Window x:Class="HideRecordSelector.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:igDP="http://infragistics.com/DataPresenter"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
		<Grid.Resources>
			<SolidColorBrush Color="YellowGreen" x:Key="CVPOverallForeground" />
			<Style TargetType="{x:Type igDP:CellValuePresenter}">
				<!--To color -->
				<Setter Property="Foreground" Value="{StaticResource CVPOverallForeground}"/>
				<!--To alternate color -->
				<Setter Property="ForegroundAlternateStyle">
					<Setter.Value>
						<Style>
							<Setter Property="TextElement.Foreground" Value="{StaticResource CVPOverallForeground}" />
						</Style>
					</Setter.Value>
				</Setter>
				<!--To color on cell activation -->
				<Setter Property="ForegroundActiveStyle">
					<Setter.Value>
						<Style>
							<Setter Property="TextElement.Foreground" Value="{StaticResource CVPOverallForeground}" />
						</Style>
					</Setter.Value>
				</Setter>
				<!--To color on cell hover-->
				<Setter Property="ForegroundHoverStyle">
					<Setter.Value>
						<Style>
							<Setter Property="TextElement.Foreground" Value="{StaticResource CVPOverallForeground}" />
						</Style>
					</Setter.Value>
				</Setter>
				<!--To color on cell selection (no hover)-->
				<Setter Property="ForegroundSelectedStyle">
					<Setter.Value>
						<Style>
							<Setter Property="TextElement.Foreground" Value="{StaticResource CVPOverallForeground}" />
						</Style>
					</Setter.Value>
				</Setter>
				<Style.Triggers>
					<!--To color on record selection-->
					<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Record.IsSelected}" Value="True">
						<Setter Property="ForegroundStyle">
							<Setter.Value>
								<Style>
									<Setter Property="TextElement.Foreground" Value="{StaticResource CVPOverallForeground}" />
								</Style>
							</Setter.Value>
						</Setter>
					</DataTrigger>
					<!--To color on record hover (no selection) -->
					<Trigger Property="IsMouseOverRecord" Value="True">
						<Setter Property="ForegroundStyle">
							<Setter.Value>
								<Style>
									<Setter Property="TextElement.Foreground" Value="{StaticResource CVPOverallForeground}" />
								</Style>
							</Setter.Value>
						</Setter>
					</Trigger>
				</Style.Triggers>
			</Style>
		</Grid.Resources>
		<igDP:XamDataGrid BindToSampleData="True" >
			<igDP:XamDataGrid.FieldLayoutSettings>
				<igDP:FieldLayoutSettings HighlightAlternateRecords="True"/>
			</igDP:XamDataGrid.FieldLayoutSettings>
        </igDP:XamDataGrid>
    </Grid>
</Window>
profile
게임하는만큼만 개발공부하자

0개의 댓글