|
Wayne, thank you this will help me understand that a great deal. But, I am retrieving the installed printer information by using System.Management and querying Win32. I can simply add image references and display them next to those if that was all there was to it. But, I was wanting to know if there was a way when retrieving the list information to determine which image was being used to represent them or do I simply create that myself?
If you open your devices and printers right now you will see a fax icon next to a fax, a printer next to a printer, and a networked printer icon next to a networked one. Is the information used to display the proper image able to be retrieved in the same manner as obtaining the printer list or do I have to setup some sort of code that can determine if the printer information received is a fax and have it display a fax image?
|
|
|
|
|
You get that info with SHGetFileInfo. It gives you the HICON back if you call it appropriately.
|
|
|
|
|
Hi!
Relatively new to WPF though have worked a bit with XNA previously and feel fairly experienced with C#.
Building a WPF control for visualizing networks in 3d. I got the network data structure of custom Node and Edge objects and I clone a GeometryModel3D object to each for each of the nodes, drawing these in my ViewPort3D according to their coordinates (Point3d). I have also created a simple cylinder shaped GeometryModel3d object, coded as a xaml resource, with base circle on the xz-plane, stretching 1 unit up on the positive y axis. Each Edge object will refer to one of these, with the appropriate scaling and rotation to connect the nodes in the graph.
My idea is to first scale the cylinder along the y-axis to reflect the distance between two connected nodes, subsequently rotating the cylinder in the correct direction, finally translating the cylinder to the first node's coordinate.
Calculating the direction that the cylinder is easy: I then create a Vector3d based on the nodal coordinates. Can I use this (non-normalized) vector directly to make my cylinder point in this direction? How do I deal with the fact that the "unmodified" cylinder object is directed along the y-axis?
Also: the whole network will animate. Though not according to a storyboard: instead, the location of the nodes will change in a spring-embedded fashion (i.e. force-directed based on relations between them). This means that for each iteration (which will involve calculating new Point3d-coordinates for the nodes), I have to rescale, rerotate and reposition the cylinders (representing arcs/edges between the nodes). How should I do this? Should I "reinitialize" the GeometryModel3D cylinder for each relation and subsequently do the scaling, rotating and translation again? Or should I calculate the differences in length (scale), rotation and position for each step and modify each cylinder? Or should I translate back to its original state and then redo the operation? As I will be dealing with quite a lot of nodes and edges, garbage collection and cpu load might be an issue here.
Or is it possible to build a "skeleton" (dunno the terminology...) in WPF 3d, thus making these edges/cylinders automatically be rotated, scaled and positioned based on some anchor points (i.e. the nodal coordinates)?
|
|
|
|
|
Ah, I think I've figured it out - and learned a bit more about WPF 3d graphics! Havent written the code for it yet (not at the office), but posting a follow-up just if someone else stumbles upon this on the net.
My first mistake: rotation transforms (any transforms) arent cumulative. If I apply a rotation transform and need to modify the rotation later on, I dont need to redo the previous rotation before the second one. The original coordinates of the GeometryModel3D remains the same all the time - I just apply my new rotation and it will replace the old one.
My cylinder is standing on the xz-plane, pointing up on the y-axis with length 1. Scaling is no problem - I just scale it in the y-direction according to the distance between the two nodes.
Rotation was trickier but I think I have figured it out. To rotate the GeometryModel3d, I use the AxisAngleRotation3D(Vector3d, angle) class for the RotateTransform3D for the GeometryModel3d object.
What I need is the axis to rotate around, plus the number of degree to rotate. As the cylinder stands on the xz-plane, the rotation axis will always be on this plane. Based on the nodal coordinate P(x1,y1,z1), I get the rotation axis by simply setting Vrotate=(-z1,0,x1). So if I want to rotate my cylinder towards Point3d(2,3,1), I set the rotation axis to be Vector3d(-1,0,2)!
The rotation degree is the angle between a Vector3d(x,y,z) and the Y-axis (0,1,0), which is easily calculated by the shorthand:
theta = arccos( y / sqrt(x²+y²+z²) )
(...as the y-axis is normalized and, yes, on the y-axis!)
I thus end up with arguments for the AxisAngleRotation3D constructor, making it easy to rotate my cylinder towards the desired point!
Of course, the example above assumes that the first node is on the origo: the above must of course be modified to accept two arbitrary Point3d coordinates...
|
|
|
|
|
Currently when we create a listbox, we will get a default light blue border on the listboxitem if the mouse is over. I hope to remove the border so that it looks nothing happens. Is there a way to make this ?
|
|
|
|
|
|
|
Im Wpf Developer but I am Fun of silverlight I Desided Design Web Site With C# Silverlight Everthings ok if Im Not Put WMA(Any media or music) in xap But When I Put Even Music in xap Web Site Very Slow Opening and 2.nd Problem is on My Leptop web site verywell shown But When I try My Web Site at Another Pc or Leptop TextBlog Resized or Looking Not Properly. Here is My Web Site Adress http://carolineolivia.com
What I Do Wrong. And What ı must Do To Performance Up My Silverlight Web Site is Only 22,9 MB Thx For Your Hellp
|
|
|
|
|
This is a repost. Avoid posting the same question in multiple places.
|
|
|
|
|
Has nothing to do with Silverlight..
What's going on while that battery progress indicator is sitting there for an excruciating amount of time?
Mark Salsbery
|
|
|
|
|
|
Pardon? I have read that sentence several times now and I can't make head nor tails of it. Try to use punctuation and capitalisation just to give us a hint as to how the sentences should actually read.
|
|
|
|
|
Yes, your XAP file was pretty big but still should load way faster. Silverlight has nothing to do with how fast your XAP file is delivered - that's up to the server and yours seems very very slow.
Mark Salsbery
|
|
|
|
|
Using WPF and MVVM pattern.
How can I tell in a DataGrid when the user changes the data in a cell?
Everything makes sense in someone's mind
|
|
|
|
|
Assuming you are letting them edit things that bind directly back to properties in a VM, you can use INotifyPropertyChanged to catch and hook into these changes.
|
|
|
|
|
I have 3 collections of data that needs to be displayed in a treeview, so I'm trying to nest them. So far my XAML looks like this:
<UserControl.Resources>
<HierarchicalDataTemplate DataType="{x:Type models:ProductModel}"
ItemsSource="{Binding Categories}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding ProductNumber}"></TextBlock>
</StackPanel>
</HierarchicalDataTemplate>
<HierarchicalDataTemplate DataType="{x:Type models:CategoryModel}"
ItemsSource="{Binding Parts}">
<StackPanel Orientation="Horizontal"
Margin="0,3,0,3">
<TextBlock Text="{Binding Caption}"></TextBlock>
</StackPanel>
</HierarchicalDataTemplate>
<DataTemplate DataType="{x:Type models:PartModel}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding PartNumber}"></TextBlock>
<TextBlock Text="-"
Margin="3,0,3,0"/>
<TextBlock Text="{Binding PartDescription}"></TextBlock>
</StackPanel>
</DataTemplate>
</UserControl.Resources>
and then
<TreeView x:Name="tvwParent"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollBarVisibility="Auto"
BorderThickness="0"
Grid.Row="5"
Grid.Column="1"
Margin="5">
<TreeViewItem Header="Products">
<DataTemplate>
<TreeView x:Name="tvwSelections"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollBarVisibility="Auto"
BorderThickness="0"
ItemsSource="{Binding Products}"/>
</DataTemplate>
</TreeViewItem>
</TreeView>
When I run it I see the Products node, but it only has one child node showing as "System.Windows.DataTemplate".
I know the templates are correct, I just cant figure out why they are not being applied to the inner tree.
Anyone see what's wrong?
[MODIFIED]
I figured it out. I removed the DataTemplate and it works perfect.
Everything makes sense in someone's mind
|
|
|
|
|
Hi Guys..
I need to add scrollviewer in dragdockpanel. how to do this? plz help me...
|
|
|
|
|
If you want to scroll the elements of your panel, you can wrap it with a ScrollViewer .
If yow want to wrap an inner part of the control with a ScrollViewer , you can do it by changing the ControlTemplate of the control.
|
|
|
|
|
Hi,
How can I have a drag and drop listbox for rearranging items. Can someone give some pointers.
I want to mimic the way how the home screen arranges the items. i.e long tap on the item to select it for drag, then drop it into a new index.
I checked silverlight toolkit, but did not find anything.
- Thanks
|
|
|
|
|
I just find one. Is the dragdroptarget help ?
public abstract class DragDropTarget<TItemsControlType,TItemContainerType> : System.Windows.Controls.ContentControl
where TItemsControlType : System.Windows.UIElement
where TItemContainerType : System.Windows.UIElement
you can find it in the silverlight toolkit.
|
|
|
|
|
Thanks, Will check this and let you know.
|
|
|
|
|
This is not available in the Windows Phone version of the toolkit.
|
|
|
|
|
I have my model in the WCF, each model representing a table in the database (they are actually based on views to make them useful). Each field is an auto property with the basic get/set (no change event).
This model is propagated to the client via the reference of the WCF. So if I want to use the model I can reference it via Service.ModelName. This works perfectly and I am happily doing all my LOB work using this structure.
However this has a number of limitations that I can find. I have no model in the client and therefore cannot implement IEditable on the model. I also don't have and OnChange events on the model fields.
So far this is not painful but I feel I am doing it wrong. However the idea that I recreate the model in the client and extend it with the interface and event capability just feels wrong, getting the data from the WCF and moving it into and out of the local models just seems too clunky for my taste.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Personally, I implement INotifyProperty on my models, then reference the models in the client. Then I instruct my WCF service reference to reuse types in all referenced assemblies. So my tiers look something like this:-
public class Employee:INotifyProperty, IDataErrorInfo
{
}
public class EmployeeDataAccess
{
}
IEmployeeService
EmployeeService
public class EmployeeViewModel
{}
public class EmployeeView
{}
Of course the client is a little more complicated than shown as it has a service manager that actually deals with data I/O and acts as a mediator between viewmodels - but that's the gist of it - and it works .
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
Let me put that in words I understand!
Your model, originating in the WCF, has the full property declaration and the interface support.
There are no changes to your model (structure and additional interfaces etc) in the client.
Never underestimate the power of human stupidity
RAH
|
|
|
|