이 컨트롤은 더 이상 사용되지 않고 그리드 구성 요소로 대체되었으므로 해당 컨트롤로 마이그레이션하는 것이 좋습니다. 새로운 기능은 제공되지 않으며 버그 수정은 우선순위에서 제외됩니다. 코드베이스를 Data Grid로 마이그레이션하는 데 도움이 필요하거나 질문이 있으면 지원팀에 문의하세요.
Blazor Grid Column Animations
Ignite UI for Blazor 열 숨기기 또는 열 이동과 같은 이벤트 중에 열 애니메이션을 지원합니다. Blazor 데이터 그리드에서 열 애니메이션이 설정되면 해당 열의 모든 셀에 대해 해당 애니메이션이 실행됩니다.
Blazor 그리드 열 애니메이션 예제
using System;
using System.Net.Http;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Text;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using IgniteUI.Blazor.Controls; // for registering Ignite UI modules
namespace Infragistics.Samples
{
public class Program
{
public static async Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("app");
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
// registering Ignite UI modules
builder.Services.AddIgniteUIBlazor(
typeof(IgbDataGridModule),
typeof(IgbGridColumnOptionsModule)
);
await builder.Build().RunAsync();
}
}
}
csusing System;
using System.Collections.Generic;
using System.Linq;
namespace Infragistics.Samples
{
public static class DataGenerator
{
readonly static string[] websites = { ".com", ".gov", ".edu", ".org" };
readonly static string[] emails = { "gmail.com", "yahoo.com", "twitter.com" };
readonly static string[] genders = { "male", "female" };
readonly static string[] maleNames = { "Kyle", "Oscar", "Ralph", "Mike", "Bill", "Frank", "Howard", "Jack", "Larry", "Pete", "Steve", "Vince", "Mark", "Alex", "Max", "Brian", "Chris", "Andrew", "Martin", "Mike", "Steve", "Glenn", "Bruce" };
readonly static string[] femaleNames = { "Gina", "Irene", "Katie", "Brenda", "Casey", "Fiona", "Holly", "Kate", "Liz", "Pamela", "Nelly", "Marisa", "Monica", "Anna", "Jessica", "Sofia", "Isabella", "Margo", "Jane", "Audrey", "Sally", "Melanie", "Greta", "Aurora", "Sally" };
readonly static string[] lastNames = { "Adams", "Crowley", "Ellis", "Martinez", "Irvine", "Maxwell", "Clark", "Owens", "Rooney", "Lincoln", "Thomas", "Spacey", "MOrgan", "King", "Newton", "Fitzgerald", "Holmes", "Jefferson", "Landry", "Berry", "Perez", "Spencer", "Starr", "Carter", "Edwards", "Stark", "Johnson", "Fitz", "Chief", "Blanc", "Perry", "Stone", "Williams", "Lane", "Jobs", "Adams", "Power", "Tesla" };
readonly static string[] countries = { "USA", "UK", "France", "Canada", "Poland" };
readonly static string[] citiesUS = { "New York", "Los Angeles", "Miami", "San Francisco", "San Diego", "Las Vegas" };
readonly static string[] citiesUK = { "London", "Liverpool", "Manchester" };
readonly static string[] citiesFR = { "Paris", "Marseille", "Lyon" };
readonly static string[] citiesCA = { "Toronto", "Vancouver", "Montreal" };
readonly static string[] citiesPL = { "Krakow", "Warsaw", "Wroclaw", "Gdansk" };
readonly static string[] citiesJP = { "Tokyo", "Osaka", "Kyoto", "Yokohama" };
readonly static string[] citiesGR = { "Berlin", "Bonn", "Cologne", "Munich", "Hamburg" };
readonly static string[] roadSuffixes = { "Road", "Street", "Way" };
readonly static string[] roadNames = { "Main", "Garden", "Broad", "Oak", "Cedar", "Park", "Pine", "Elm", "Market", "Hill" };
public static Random Rand = new Random();
public static string GetWebsite()
{
return GetItem(websites);
}
public static string GetEmail()
{
return GetItem(emails);
}
public static double GetNumber(double min, double max)
{
return Math.Round(min + (Rand.NextDouble() * (max - min)));
}
public static int GetInteger(double min, double max)
{
return (int)GetNumber(min, max);
}
public static string GetPhone()
{
var phoneCode = GetNumber(100, 900);
var phoneNum1 = GetNumber(100, 900);
var phoneNum2 = GetNumber(1000, 9000);
var phone = phoneCode + "-" + phoneNum1 + "-" + phoneNum2;
return phone;
}
public static string GetGender()
{
return GetItem(genders);
}
public static string GetNameFirst(string gender)
{
if (gender == "male")
return GetItem(maleNames);
else
return GetItem(femaleNames);
}
public static string GetNameLast()
{
return GetItem(lastNames);
}
public static string GetItem(string[] array)
{
var index = (int)Math.Round(GetNumber(0, array.Length - 1));
return array[index];
}
public static string GetCountry()
{
return GetItem(countries);
}
public static string GetCity(string country)
{
if (country == "Canada")
{
return GetItem(citiesCA);
}
else if (country == "France")
{
return GetItem(citiesFR);
}
else if (country == "Poland")
{
return GetItem(citiesPL);
}
else if (country == "USA")
{
return GetItem(citiesUS);
}
else if (country == "Japan")
{
return GetItem(citiesJP);
}
else if (country == "Germany")
{
return GetItem(citiesGR);
}
else
{ // if (country === "United Kingdom") {
return GetItem(citiesUK);
}
}
public static string GetStreet()
{
var num = Math.Round(GetNumber(100, 300)).ToString();
var road = GetItem(roadNames);
var suffix = GetItem(roadSuffixes);
return num + " " + road + " " + suffix;
}
public static DateTime GetBirthday()
{
var year = DateTime.Now.Year - GetInteger(30, 50);
var month = GetNumber(10, 12);
var day = GetNumber(20, 27);
return new DateTime(year, (int)month, (int)day);
}
public static DateTime GetDate()
{
var year = DateTime.Now.Year;
var month = GetNumber(10, 12);
var day = GetNumber(20, 27);
return new DateTime(year, (int)month, (int)day);
}
public static string Pad(int num, int size)
{
var s = num + "";
while (s.Length < size)
{
s = "0" + s;
}
return s;
}
public static string GetPhotoMale(int id)
{
return "https://static.infragistics.com/xplatform/images/people/GUY" + Pad(id, 2) + ".png";
}
public static string GetPhotoFemale(int id)
{
return "https://static.infragistics.com/xplatform/images/people/GIRL" + Pad(id, 2) + ".png";
}
private static int maleCount = 0;
private static int femaleCount = 0;
public static string GetPhoto(string gender)
{
if (gender == "male")
{
maleCount++;
if (maleCount > 24) maleCount = 1;
return GetPhotoMale(maleCount);
}
else
{
femaleCount++;
if (femaleCount > 24) femaleCount = 1;
return GetPhotoFemale(femaleCount);
}
}
public static string GetGenderPhoto(string gender)
{
return "https://static.infragistics.com/xplatform/images/genders/" + gender + ".png";
}
public static string GetCountryFlag(string country)
{
return "https://static.infragistics.com/xplatform/images/flags/" + country + ".png";
}
public static string GetIncomeRange(double salary)
{
if (salary < 50000)
{
return "Low";
}
else if (salary < 100000)
{
return "Average";
}
else
{
return "High";
}
}
}
}
csusing System;
using System.Collections.Generic;
using System.ComponentModel;
namespace Infragistics.Samples
{
public class Employee : INotifyPropertyChanged
{
public string ID { get; set; }
public string Address { get; set; }
public double Age { get; set; }
public string Gender { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Name { get; set; }
public string Street { get; set; }
public string City { get; set; }
public string Email { get; set; }
public string Phone { get; set; }
public string Photo { get; set; }
public double Salary { get; set; }
public double Sales { get; set; }
public string Income { get; set; }
public int Index { get; set; }
public DateTime Birthday { get; set; }
public List<Productivity> Productivity { get; set; }
private string _Country;
public string Country
{
get { return _Country; }
set { if (_Country != value) { OnCountryChanged(value); } }
}
public string CountryFlag { get; set; }
protected void OnCountryChanged(string countryName)
{
// syncronizing country name and country flag
_Country = countryName;
CountryFlag = DataGenerator.GetCountryFlag(countryName);
City = DataGenerator.GetCity(countryName);
OnPropertyChanged("Country");
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
public class Productivity
{
public double Value { get; set; }
public int Week { get; set; }
}
public static class EmployeeData
{
public static List<Employee> Create(int? count, bool? useProductivity)
{
if (count == null) count = 100;
var employees = new List<Employee>();
for (int i = 0; i < count; i++)
{
var age = Math.Round(DataGenerator.GetNumber(20, 40));
var gender = DataGenerator.GetGender();
var firstName = DataGenerator.GetNameFirst(gender);
var lastName = DataGenerator.GetNameLast();
var street = DataGenerator.GetStreet();
var country = DataGenerator.GetCountry();
var city = DataGenerator.GetCity(country);
var email = firstName.ToLower() + "@" + DataGenerator.GetEmail();
var photoPath = DataGenerator.GetPhoto(gender);
var employee = new Employee
{
Index = i,
Address = street + ", " + city,
Age = age,
Birthday = DataGenerator.GetBirthday(),
City = city,
Email = email,
Gender = gender,
ID = DataGenerator.Pad(1001 + i, 4),
FirstName = firstName,
LastName = lastName,
Name = firstName + " " + lastName,
Photo = photoPath,
Phone = DataGenerator.GetPhone(),
Street = DataGenerator.GetStreet(),
Salary = DataGenerator.GetNumber(40, 200) * 1000,
Sales = DataGenerator.GetNumber(200, 980) * 1000,
};
employee.Country = country;
employee.Income = DataGenerator.GetIncomeRange(employee.Salary);
if (useProductivity.HasValue && useProductivity.Value)
{
employee.Productivity = GetProductivity(52);
}
employees.Add(employee);
}
return employees;
}
public static List<Productivity> GetProductivity(int weekCount)
{
var productivity = new List<Productivity>();
for (var w = 1; w <= weekCount; w++)
{
var value = DataGenerator.GetNumber(-50, 50);
var prod = new Productivity
{
Value = value,
Week = w
};
productivity.Add(prod);
};
return productivity;
}
}
}
cs
@using IgniteUI.Blazor.Controls
<div class="container vertical">
<div class="options horizontal">
<label class="options-item" style="width: 9rem">Adding Animation: </label>
<select class="options-item" style="width: 9rem" @bind="ShowingAddingAnimation">
<option>@ColumnShowingAnimationMode.Auto</option>
<option>@ColumnShowingAnimationMode.None</option>
<option>@ColumnShowingAnimationMode.SlideFromLeft</option>
<option>@ColumnShowingAnimationMode.SlideFromRight</option>
<option>@ColumnShowingAnimationMode.SlideFromTop</option>
<option>@ColumnShowingAnimationMode.SlideFromBottom</option>
<option>@ColumnShowingAnimationMode.FadeIn</option>
<option>@ColumnShowingAnimationMode.SlideFromLeftAndFadeIn</option>
<option>@ColumnShowingAnimationMode.SlideFromRightAndFadeIn</option>
<option>@ColumnShowingAnimationMode.SlideFromTopAndFadeIn</option>
<option>@ColumnShowingAnimationMode.SlideFromBottomAndFadeIn</option>
</select>
<span class="options-item" style="width: 9rem">Exchange Animation: </span>
<select class="options-item" style="width: 9rem" @bind="ExchangeAnimation">
<option>@ColumnExchangingAnimationMode.Auto</option>
<option>@ColumnExchangingAnimationMode.None</option>
<option>@ColumnExchangingAnimationMode.SlideToLeft</option>
<option>@ColumnExchangingAnimationMode.SlideToRight</option>
<option>@ColumnExchangingAnimationMode.SlideToTop</option>
<option>@ColumnExchangingAnimationMode.SlideToBottom</option>
<option>@ColumnExchangingAnimationMode.Crossfade</option>
<option>@ColumnExchangingAnimationMode.SlideToLeftAndCrossfade</option>
<option>@ColumnExchangingAnimationMode.SlideToRightAndCrossfade</option>
<option>@ColumnExchangingAnimationMode.SlideToTopAndCrossfade</option>
<option>@ColumnExchangingAnimationMode.SlideToBottomAndCrossfade</option>
</select>
</div>
<div class="options horizontal">
<span class="options-item" style="width: 9rem">Hiding Animation: </span>
<select class="options-item" style="width: 9rem" @bind="HidingAnimation">
<option>@ColumnHidingAnimationMode.Auto</option>
<option>@ColumnHidingAnimationMode.None</option>
<option>@ColumnHidingAnimationMode.SlideToLeft</option>
<option>@ColumnHidingAnimationMode.SlideToRight</option>
<option>@ColumnHidingAnimationMode.SlideToTop</option>
<option>@ColumnHidingAnimationMode.SlideToBottom</option>
<option>@ColumnHidingAnimationMode.FadeOut</option>
<option>@ColumnHidingAnimationMode.SlideToLeftAndFadeOut</option>
<option>@ColumnHidingAnimationMode.SlideToRightAndFadeOut</option>
<option>@ColumnHidingAnimationMode.SlideToTopAndFadeOut</option>
<option>@ColumnHidingAnimationMode.SlideToBottomAndFadeOut</option>
</select>
<span class="options-item" style="width: 9rem">Updating Animation: </span>
<select class="options-item" style="width: 9rem" @bind="UpdatingAnimation">
<option>@ColumnPropertyUpdatingAnimationMode.Auto</option>
<option>@ColumnPropertyUpdatingAnimationMode.None</option>
<option>@ColumnPropertyUpdatingAnimationMode.Interpolate</option>
<option>@ColumnPropertyUpdatingAnimationMode.InterpolateDeep</option>
</select>
</div>
<div class="options horizontal">
<span class="options-item" style="width: 9rem">Moving Animation: </span>
<select class="options-item" style="width: 9rem" @bind="MovingAnimation">
<option>@ColumnMovingAnimationMode.Auto</option>
<option>@ColumnMovingAnimationMode.None</option>
<option>@ColumnMovingAnimationMode.SlideOver</option>
</select>
<button class="options-item" @onclick="OnHideClick">Hide Column</button>
<button class="options-item" @onclick="OnShowClick">Show Column</button>
<button class="options-item" @onclick="OnReloadClick">Reload Grid</button>
</div>
<div class="container vertical" style="height: calc(100% - 125px)">
@if (Data != null)
{
<div style="overflow: hidden">
<IgbDataGrid Height="100%" Width="100%" @ref="DataGridRef"
DefaultColumnMinWidth="100"
ColumnAddingAnimationMode="@ShowingAddingAnimation"
ColumnShowingAnimationMode="@ShowingAddingAnimation"
ColumnExchangingAnimationMode="@ExchangeAnimation"
ColumnHidingAnimationMode="@HidingAnimation"
ColumnMovingAnimationMode="@MovingAnimation"
ColumnPropertyUpdatingAnimationMode="@UpdatingAnimation"
AutoGenerateColumns="false"
DataSource="Data"
IsColumnOptionsEnabled="true">
<IgbTextColumn Field="Name" Width="@("*>170")" />
<IgbTextColumn Field="Street" HeaderText="Address" Width="@("*>150")" />
<IgbTextColumn Field="City" Width="@("*>120")" />
<IgbNumericColumn Field="Salary" Width="@("*>120")" PositivePrefix="$" ShowGroupingSeparator="true" />
<IgbDateTimeColumn Field="Birthday" Width="@("*>170")" />
<IgbTextColumn Field="Country" Width="@("*>120")" />
<IgbNumericColumn Field="Sales" Width="@("*>120")" PositivePrefix="$" ShowGroupingSeparator="true" />
<IgbNumericColumn Field="Age" Width="@("*>120")" />
<IgbTextColumn Field="Email" Width="@("*>120")" />
</IgbDataGrid>
</div>
}
</div>
</div>
@code {
private List<Employee> Data;
private IgbDataGrid DataGridRef;
private ColumnShowingAnimationMode ShowingAddingAnimation = ColumnShowingAnimationMode.SlideFromLeft;
private ColumnExchangingAnimationMode ExchangeAnimation = ColumnExchangingAnimationMode.Crossfade;
private ColumnHidingAnimationMode HidingAnimation = ColumnHidingAnimationMode.FadeOut;
private ColumnPropertyUpdatingAnimationMode UpdatingAnimation = ColumnPropertyUpdatingAnimationMode.Interpolate;
private ColumnMovingAnimationMode MovingAnimation = ColumnMovingAnimationMode.SlideOver;
protected override void OnInitialized()
{
this.Data = EmployeeData.Create(100, false);
}
private void OnHideClick(MouseEventArgs e)
{
foreach (IgbDataGridColumn col in this.DataGridRef.ActualColumns)
{
if (!col.IsHidden)
{
col.IsHidden = true;
break;
}
}
}
private void OnReloadClick(MouseEventArgs e)
{
List<Employee> newData = EmployeeData.Create(100, false);
for (int i = 0; i < newData.Count; i++)
{
Employee oldData = this.Data[i];
this.Data[i].Salary = newData[i].Salary;
this.DataGridRef.NotifySetItem(this.Data, i, oldData, newData[i]);
}
}
private void OnShowClick(MouseEventArgs e)
{
IEnumerable<IgbDataGridColumn> revColumns = this.DataGridRef.ActualColumns.Reverse();
foreach (IgbDataGridColumn col in revColumns)
{
if (col.IsHidden)
{
col.IsHidden = false;
break;
}
}
this.DataGridRef.ActualColumns.Reverse();
}
}
razor/*
CSS styles are loaded from the shared CSS file located at:
https://static.infragistics.com/xplatform/css/samples/
*/
css
이 샘플이 마음에 드시나요? Ignite UI for Blazor에 액세스하고 몇 분 만에 나만의 앱을 빌드하기 시작하세요. 무료로 다운로드하세요.
애니메이션 속성
각 열 애니메이션 속성은 아래에 나열 및 설명되어 있습니다.
ColumnAddingAnimationMode
: 열이 추가되면 열 머리글과 해당 셀이 왼쪽, 오른쪽, 위쪽 또는 아래쪽에서 슬라이드되도록 하는 옵션이 있습니다. 페이드 인, 슬라이드 및 페이드 인 옵션도 있습니다.ColumnExchangingAnimationMode
: 열이 교환되면 교환된 열 머리글과 해당 셀이 왼쪽, 오른쪽, 위쪽 또는 아래쪽으로 슬라이드되도록 하는 옵션이 있습니다. 페이드, 슬라이드 및 페이드 옵션도 있습니다.ColumnHidingAnimationMode
: 열이 숨겨져 있으면 열 머리글과 해당 셀이 왼쪽, 오른쪽, 위쪽 또는 아래쪽으로 미끄러지도록 하는 옵션이 있습니다. 페이드 아웃, 슬라이드 및 페이드 아웃 옵션도 있습니다.ColumnMovingAnimationMode
: 열이 이동되면 열 머리글과 해당 셀이 미끄러지도록 하는 옵션이 있습니다.ColumnPropertyUpdatingAnimationMode
: 열의 속성이 변경되면 해당 변경 사항을 보간하거나 심층적으로 보간하여 해당 속성 변경 내용을 애니메이션화할 수 있는 옵션이 있습니다.ColumnShowingAnimationMode
: 열이 추가되면 열 머리글과 해당 셀이 왼쪽, 오른쪽, 위쪽 또는 아래쪽에서 슬라이드되도록 하는 옵션이 있습니다. 페이드 인, 슬라이드 및 페이드 인 옵션도 있습니다.
코드 조각
다음은 이 항목에 설명된 각 열 애니메이션의 구현을 보여줍니다.
<IgbDataGrid Height="100%" Width="100%"
DataSource="DataSource"
ColumnAddingAnimationMode="ColumnShowingAnimationMode.SlideFromLeft"
ColumnExchangingAnimationMode="ColumnExchangingAnimationMode.SlideToRight"
ColumnHidingAnimationMode="ColumnHidingAnimationMode.SlideToTopAndFadeOut"
ColumnMovingAnimationMode="ColumnMovingAnimationMode.SlideOver"
ColumnPropertyUpdatingAnimationMode="ColumnPropertyUpdatingAnimationMode.Interpolate"
ColumnShowingAnimationMode="ColumnShowingAnimationMode.SlideFromBottomAndFadeIn" />
razor
API 참조
ColumnAddingAnimationMode
ColumnExchangingAnimationMode
ColumnHidingAnimationMode
ColumnMovingAnimationMode
ColumnPropertyUpdatingAnimation