I am interested to inject a ViewModel into the mix via the parent UserControl DataContext, which subsequently should relay that value to an Attached Dependency Property.
I'd like for interested views and models contained by the UserControl, or children therein, to be able to access the same attached property value.
I am studying some issues and 'tutorials' online, but thus far haven't had much luck retrieving the attached property value. I can listen for DataContext, no problem however.
Has anyone ever dealt with Attached Dependency Properties, or perhaps knows a good tutorial that explains it?
It's also possible that I need for 'children' of the problem to register with the property, but none of the examples stipulate that, or have conveniently left that part out (i.e. it's been alluded to in places).
Any insight is welcome.
If we inspect the code we can see that it controls whether CurrentPosition is calculated or not:
protected override void OnMouseMove(MouseEventArgs e)
var pt = e.GetPosition(this);
var pos = this.FindNearestPoint(pt);
if (pos != null)
this.CurrentPosition = pos.Value;
var p = this.Viewport.UnProject(pt);
if (p != null)
this.CurrentPosition = p.Value;
So, each time OnMouseMove method is called the (Point3D) pos is calculated (by FindNearstPoint) and that may be a costly operation to perform each time the mouse is moved.
Why CurrentPosition is needed and why it is optional?
behnam263 wrote at 2014-08-26 13:22:
I'am reading an STL file in my WPF c# application. I want to store it to database. All database connections are done but I don't know how to store 3d model in database. What kind of converting needed for this purpose? And later similarly I want to get that information from database to turn it 3d models.Is there any basic function for STL converting to binaries then merging it again?
FaceMaterial default's color is blue , I need to change facematerial color by C#
main.FaceMaterial = Materials.Red
and try to set transparent
main.FaceMaterial = nothing
it's not happen anything. 'main' it still 'Blue'
Please help. How can I change this property?
and Thanks to all answer and suggestion.
I adding to my viewport3d a model (STL file) using ModelImport function but first nothing show up. To see added 3DModel I have to do zoom out. My question is, are there any way to do dynamically/programmatically zoom out or rotate camera to the newly added model or anything needed to show it immediately.
I am using C# WPF.
Customer support service by UserEcho