Here i will explain TextBox control in various technology like asp.net c#, windows form, wpf, Jquery. Given a simple example of TextBox control in asp.net c#, windows form, wpf, Jquery etc.
In this article i will explain about style in wpf, How to use staticResources in wpf. Through the windows.Resources tag i will explain how to use style in xaml. Also use the DynamicResources in app.xaml file. Example of DynamicResourcs style in app.xaml file.
Description
If you want to do some changes in formatting of your page or control then add some attribute like Background Foreground etc in xaml tag.But if you want to do same changes with 1000 of controls then what to do. There are two options first one is changes in all tags and second one is changes in one place but effect appear in all controls. Now, this example i will use both methods for you.
This video cover:
How to add TextBlock in wpf window, How to add inline style in wpf . How to add foreground and background of TextBlock in wpf. Example of TextBlock control in wpf. How to change color of TextBlock in wpf. How to change foreground and background color of button control. How to use window.Resources in wpf. Example of window.Resources. How to create style in window.Resources. Example of style tag in xaml. Example of setter property of style tag. How to apply style on controls in wpf.
DynamicResources in WPF
This video cover:
How to use Application.Resources in wpf, example of Application.Resources. How to add style in app.xaml file. Example of TargetType property of style tag in wpf. How to use setter property of style in application.Resources tag. How to use application.Resources code on wpf controls.
In this article i will show you how to bind the dropdownlist to countries name. You can say load dropdownlist from countries names like United State, United Kingdom etc in asp.net c#. By the System.Globalization namespace you can bind dropdownlist to countries name in asp.net c#.
In previous article i explained some topics on dropdownlist:
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class BindCountries : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if(!Page.IsPostBack)
{
List<string> countries = new List<string>();
CultureInfo[] culture = CultureInfo.GetCultures(CultureTypes.SpecificCultures);
foreach (CultureInfo item in culture)
{
RegionInfo region = new RegionInfo(item.LCID);
if(!(countries.Contains(region.EnglishName)))
{
countries.Add(region.EnglishName);
}
}
countries.Sort();
DropDownList1.DataSource = countries;
DropDownList1.DataBind();
}
}
}
Above mentioned code define the following:
I have a list with string type, bind this English name of all countries name using System.Globalization namespace. First to bind array with the all cultures, now from all cultures you can get specific region.
If you want to bind the text box with the instance of customer class object also call one way binding in wpf. first to add a cs class in the project. In which you should take one or more public properties , i will take two public properties and one static method. That static method will return class object. Now, your code look like:
1. Add a Class in the project also paste the below mentioned code. But remember that your class name is match with csharp file name; namespace name match with code.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SplashSCreen
{
public class Student
{
public string Name { get; set; }
public string Email { get; set; }
public static Student GetRecord()
{
var student = new Student();
{
student.Name = "Jacob";
student.Email = "narenkumar851@gmail.com";
};
return student;
}
}
}
2. Add a new window in the project. 3. Paste this code inside the grid of window class.
The means of splash screen is a screen through which we can show the booting process of a thread. When you start your computer then first to load booting process after then load operating system. I will do the same thing in wpf. This screen appear before loading the start page. So lets to start it:
1. First to add a new window in the project. 2. Add these properties inside window tag.
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
namespace SplashSCreen
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
private const int min_spl_time = 4000;
protected override void OnStartup(StartupEventArgs e)
{
SplashScreen splash = new SplashScreen();
splash.Show();
Stopwatch timer = new Stopwatch();
timer.Start();
base.OnStartup(e);
MainWindow main = new MainWindow();
timer.Stop();
int remaining_time = min_spl_time - (int)timer.ElapsedMilliseconds;
if (remaining_time > 0)
Thread.Sleep(remaining_time);
splash.Close();
}
}
}
Here SplashScreen is the name of window or you can say class name.
Before deleting the data from the dataGrid, first to load the DataGrid using Edmx file. This is done in previous article. In this article we have new column that is DataGridTemplateColumn , in which we have cell template. When we click on button then row is deleted from DataGrid. Before deleting data from DataGrid , access emp_id from selected row .
In this article we will learn how to bind DataGrid using EDMX file in wpf. I already bind dataGrid in window form using EDMX. In both article, i notice that only one difference between both that is xaml file. Lets to start to design this in wpf:
Above mentioned code define the binding structure. I have one dataGrid control in the window. x:Name is a property of each control which is define the class instance , through which we can access other property of control in business logic. I have two Text column in dataGrid which take two attribute first one is Binding and another one is Header. Header represent the DataGrid column name and binding define the actual name of database table column's name.
Note : Before going to code behind must to add EDMX file in the project.
using System.Linq;
using System.Windows;
namespace SplashSCreen
{
/// <summary>
/// Interaction logic for bindgridpanel.xaml
/// </summary>
public partial class bindgridpanel : Window
{
TutorialEntities TE = new TutorialEntities();
public bindgridpanel()
{
InitializeComponent();
loadgrid();
}
private void loadgrid()
{
var data = from d in TE.emps select d;
dataGrid.ItemsSource = data.ToList();
}
}
}
Code generate the following output
After add the edmx file in the project , you can access the public property of context class (here i have 'emps'). Through which we can apply operation on dataGrid.