Click here to Skip to main content
15,887,477 members
Home / Discussions / WPF
   

WPF

 
QuestionBinding not initially filling in List of data Pin
Sutton Mehaffey9-Apr-12 7:32
Sutton Mehaffey9-Apr-12 7:32 
Questionboolean attached property Pin
michaelgr19-Apr-12 7:10
michaelgr19-Apr-12 7:10 
Question2 WPF Style Questions Pin
Kevin Marois9-Apr-12 7:09
professionalKevin Marois9-Apr-12 7:09 
AnswerRe: 2 WPF Style Questions Pin
Bernhard Hiller10-Apr-12 0:06
Bernhard Hiller10-Apr-12 0:06 
QuestionWPF 3D Pin
Kul_77-Apr-12 4:52
Kul_77-Apr-12 4:52 
AnswerRe: WPF 3D PinPopular
Wes Aday7-Apr-12 5:09
professionalWes Aday7-Apr-12 5:09 
AnswerRe: WPF 3D Pin
Abhinav S7-Apr-12 20:08
Abhinav S7-Apr-12 20:08 
GeneralRe: WPF 3D Pin
Kuldeep B8-Apr-12 1:29
Kuldeep B8-Apr-12 1:29 
.cs

public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
drawcube();
drawcube2();
}

private void drawcube()
{
Model3DGroup cube = new Model3DGroup();
Point3D p0 = new Point3D(3, 3, 3);
Point3D p1 = new Point3D(5, 3, 3);
Point3D p2 = new Point3D(5, 3, 5);
Point3D p3 = new Point3D(3, 3, 5);
Point3D p4 = new Point3D(3, 5, 3);
Point3D p5 = new Point3D(5, 5, 3);
Point3D p6 = new Point3D(5, 5, 5);
Point3D p7 = new Point3D(3, 5, 5);
//front side triangles
cube.Children.Add(CreateTriangleModel(p3, p2, p6));
cube.Children.Add(CreateTriangleModel(p3, p6, p7));
//right side triangles
cube.Children.Add(CreateTriangleModel(p2, p1, p5));
cube.Children.Add(CreateTriangleModel(p2, p5, p6));
//back side triangles
cube.Children.Add(CreateTriangleModel(p1, p0, p4));
cube.Children.Add(CreateTriangleModel(p1, p4, p5));
//left side triangles
cube.Children.Add(CreateTriangleModel(p0, p3, p7));
cube.Children.Add(CreateTriangleModel(p0, p7, p4));
//top side triangles
cube.Children.Add(CreateTriangleModel(p7, p6, p5));
cube.Children.Add(CreateTriangleModel(p7, p5, p4));
//bottom side triangles
cube.Children.Add(CreateTriangleModel(p2, p3, p0));
cube.Children.Add(CreateTriangleModel(p2, p0, p1));

ModelVisual3D model1 = new ModelVisual3D();
model1.Content = cube;
this.mainViewport.Children.Add(model1);
}

private void drawcube2()
{
Model3DGroup cube2 = new Model3DGroup();
Point3D p0 = new Point3D(4, 4, 4);
Point3D p1 = new Point3D(5, 4, 4);
Point3D p2 = new Point3D(5, 4, 5);
Point3D p3 = new Point3D(4, 4, 5);
Point3D p4 = new Point3D(4, 5, 4);
Point3D p5 = new Point3D(5, 5, 4);
Point3D p6 = new Point3D(5, 5, 5);
Point3D p7 = new Point3D(4, 5, 5);
//front side triangles
cube2.Children.Add(CreateTriangleModel(p3, p2, p6));
cube2.Children.Add(CreateTriangleModel(p3, p6, p7));
//right side triangles
cube2.Children.Add(CreateTriangleModel(p2, p1, p5));
cube2.Children.Add(CreateTriangleModel(p2, p5, p6));
//back side triangles
cube2.Children.Add(CreateTriangleModel(p1, p0, p4));
cube2.Children.Add(CreateTriangleModel(p1, p4, p5));
//left side triangles
cube2.Children.Add(CreateTriangleModel(p0, p3, p7));
cube2.Children.Add(CreateTriangleModel(p0, p7, p4));
//top side triangles
cube2.Children.Add(CreateTriangleModel(p7, p6, p5));
cube2.Children.Add(CreateTriangleModel(p7, p5, p4));
//bottom side triangles
cube2.Children.Add(CreateTriangleModel(p2, p3, p0));
cube2.Children.Add(CreateTriangleModel(p2, p0, p1));

ModelVisual3D model = new ModelVisual3D();
model.Content = cube2;
this.mainViewport1.Children.Add(model);
}
private Model3DGroup CreateTriangleModel(Point3D p0, Point3D p1, Point3D p2)
{
MeshGeometry3D mesh = new MeshGeometry3D();
mesh.Positions.Add(p0);
mesh.Positions.Add(p1);
mesh.Positions.Add(p2);
mesh.TriangleIndices.Add(0);
mesh.TriangleIndices.Add(1);
mesh.TriangleIndices.Add(2);
Vector3D normal = CalculateNormal(p0, p1, p2);
mesh.Normals.Add(normal);
mesh.Normals.Add(normal);
mesh.Normals.Add(normal);
Material material = new DiffuseMaterial(
new SolidColorBrush(Colors.Red));
GeometryModel3D model = new GeometryModel3D(
mesh, material);
Model3DGroup group = new Model3DGroup();
group.Children.Add(model);
return group;
}
private Vector3D CalculateNormal(Point3D p0, Point3D p1, Point3D p2)
{
Vector3D v0 = new Vector3D(
p1.X - p0.X, p1.Y - p0.Y, p1.Z - p0.Z);
Vector3D v1 = new Vector3D(
p2.X - p1.X, p2.Y - p1.Y, p2.Z - p1.Z);
return Vector3D.CrossProduct(v0, v1);
}
}
}
GeneralRe: WPF 3D Pin
Kuldeep B8-Apr-12 1:40
Kuldeep B8-Apr-12 1:40 
QuestionLOOP THOUGH THE ROWS OF A TWO COLUMN WPF DATAGRID AND FORM A LIST COLLECTION WITH THE ELEMENTS Pin
Valentine 27-Apr-12 2:24
Valentine 27-Apr-12 2:24 
AnswerRe: LOOP THOUGH THE ROWS OF A TWO COLUMN WPF DATAGRID AND FORM A LIST COLLECTION WITH THE ELEMENTS Pin
Mycroft Holmes7-Apr-12 16:21
professionalMycroft Holmes7-Apr-12 16:21 
QuestionWPF Border Drop Shadow Trigger Pin
Kevin Marois6-Apr-12 12:27
professionalKevin Marois6-Apr-12 12:27 
QuestionResource dictionary Pin
michaelgr16-Apr-12 9:46
michaelgr16-Apr-12 9:46 
AnswerRe: Resource dictionary Pin
RobCroll6-Apr-12 12:47
RobCroll6-Apr-12 12:47 
GeneralRe: Resource dictionary Pin
michaelgr16-Apr-12 20:54
michaelgr16-Apr-12 20:54 
GeneralRe: Resource dictionary Pin
RobCroll7-Apr-12 1:53
RobCroll7-Apr-12 1:53 
QuestionWindow Background Image Pin
Kevin Marois6-Apr-12 6:07
professionalKevin Marois6-Apr-12 6:07 
QuestionScript warning in WPF WebBrowser Pin
Mahesha9995-Apr-12 10:08
Mahesha9995-Apr-12 10:08 
QuestionASP Silverlight control unable to call a web service from the debugger Pin
Steve Holdorf5-Apr-12 6:36
Steve Holdorf5-Apr-12 6:36 
AnswerRe: ASP Silverlight control unable to call a web service from the debugger Pin
Abhinav S5-Apr-12 6:47
Abhinav S5-Apr-12 6:47 
QuestionWPF Merged Resource Dictionary Pin
Kevin Marois4-Apr-12 7:06
professionalKevin Marois4-Apr-12 7:06 
GeneralRe: WPF Merged Resource Dictionary Pin
Kevin Marois4-Apr-12 7:34
professionalKevin Marois4-Apr-12 7:34 
GeneralRe: WPF Merged Resource Dictionary Pin
Mycroft Holmes4-Apr-12 14:38
professionalMycroft Holmes4-Apr-12 14:38 
GeneralRe: WPF Merged Resource Dictionary Pin
Kevin Marois5-Apr-12 5:31
professionalKevin Marois5-Apr-12 5:31 
Questionwpf-mediaElement Pin
mane08064-Apr-12 5:44
mane08064-Apr-12 5:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.