|
Hi guys,
I'm about re-planning a larger LOB application (an older version, created as a 2-tier solution is already existing and running for a couple of years). The plan is to go from 2-tier to 3-tier. We are not about to reuse code, so in this regard I'm totally free! Ah yes, it's not a web-application (so no ASP.NET or Silverlight)... Merely Winforms/WPF...
What I am thinking about is whether or not to not make all service directly accessible via a WCF-Service (per class) or going to implement a single Service for communication (call it "CommService" which can send and receive serialized objects) to handle data exchange.
The application relies on several different entities (so I definetly have to implement a couple of WCF-Services when using the one-service-per-entity approach).
What would be the best approach in your opinion?
Greetings,
Stephan Eberle
hawke@deltacity.org
|
|
|
|
|
Hi,
I'd like to derive a DataTable instance from my WPF DataGrid. The DataGrid has a list of objects that make up the datasource for the grid. I need to generate a report from the grid's content. The report unfortunately can't use wpf components as the datasource I'm using telerik reporting and need to send the dataTable as a parameter when creating an instance. Is there an easy way to do this? Even if its not a DataTable and rather some other data structure that reflects the Datagrid's content, that would also work. I don't particularly want to program a function to do this if there is an easier way.
Thanx
|
|
|
|
|
How did you create your datagrid? Do you bind to something like an ObservableCollection? If so, your collection wraps individual instances of items, and you could send this over to the reporting (I'm assuming it supports accepting information from IEnumerable<T> here).
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Yes I used an ObservableCollection<ITenderLineItem> to display my DataSource. The thing is that I'm allowing my user to display certain Items and not others. If I send this collection through to my report, will i be able to create a binding source and set my reports datasource to this collection?
|
|
|
|
|
K. It seems to be working
|
|
|
|
|
Excellent.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Actually in code behind we can use
canvasname.children.add()
directly
but when using mvvm model through viewmodel
how to access that canvas name from view because i want to add
children to canvas through viewmodel
please explain me how to do that
how to access the layout control from view to viewmodel
|
|
|
|
|
There are a few ways to do based on your requirement.
1. You can create one attached property that you can bind the content of the Canvas to the property of ViewModel.
2. If you are using Prism v2 framework, you can register it as a region and get the access of that region from View Model.
What do you want to add to the Canvas? Can you provide more details about your scenario so that we can help you more easily?
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
Microsoft MVP (Silverlight), WPF/Silverlight Insiders
|
|
|
|
|
I'm doing the same and having a problem with it. At present I have code behind that links to a canvas but want to move the code to the viewmodel
<Canvas x:Name="LayoutRoot" >
<TextBlock Text="{Binding Path=Items}" />
</Canvas>
Code behind causing the problem
ticker = new Ticker<TickerItem>(LayoutRoot);
And the public class that needs a panel
public Ticker(Panel container){...}
Any help on this would be great thanks
|
|
|
|
|
Never mind... I figured it out!
I just needed to add
<Canvas x:Name="LayoutRoot" >
<TextBlock Text="{Binding Path=Items}"/>
<ContentPresenter Content="{Binding Path=LayoutRoot}" />
</Canvas> And create a new Canvas object in the viewmodel
public Canvas LayoutRoot{ get; private set; }
public viewModel
{
LayoutRoot= new Canvas();
ticker = new Ticker<TickerItem>(LayoutRoot);
}
|
|
|
|
|
I am trying to implement a Drag and Drop labeling system like Gmail uses. Just a list of labels that can be dragged atop any entity in my system. All entities in the application will extend from a base class that will accept the label-drop and adorn itself appropriately with the dropped label. I need to be able to multi-select labels and drag them as well!
any ideas? I've seen a number of drag and drop examples, but none of them are like a labeling system!
|
|
|
|
|
Shafique,
Best option would be to take one of the examples you've found, and change it to implement what you want..
Take this example for instance..
Drag and Drop Items in a WPF ListView[^..
If you add a 2nd list of labels, and use the existing list as your "entities", and work at it from there.
|
|
|
|
|
the way i see, i should have two Tree's. One Tree will be for favorites, and the other tree will be for Non-favorite labels. what do you think?
I think the link you sent looks pretty helpful..
thanks!
|
|
|
|
|
Hi All,
I started developing simple application in WPF and XAML.
I want to try accessign the sql server database and display the data from stored procedure onto the UI form.
I have a table called parentProject -> idParentProject (pk), txtParentProjName varchar(max).
my SP is parentProj_sp -> select * from parentProject.
n
I want to use a dropdown list in which, If the sp returns say (3) records, then dropdownlist should have those 3 records retreived from sp.
similar manner, I have subproject -> idsubproject(pk), idParentProject , txtSubProjectName varchar(max), dateProjstart, dateprojectend.
once the parentprojectname is selected from first dropdown, then, subproject dropdown should be enabled and it should have the subprojectnames for the corresponding parent project.
my sp is subproject_sp -> SELECT dtProjectStart, dtProjectEnd FROM tblSubProject WHERE (idParentProject = @idProjectIndex).
please help me how to connect to database in C# using WPF and XAML.
My main intention, is connecting to database in WPF.
Thank You,
Ramm
|
|
|
|
|
There are many ways to do this, but the most obvious one would be to use Linq to hook up to the stored proc. This would give you a workable model - then you would hook this data from a view model into your view. It's relatively straightforward, then, to synchronise between two lists so that your sub project is refreshed whenever your projects list changes.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Hi,
I've googled myself silly with no luck... Using SL3, all I need to do is bind a container control to a List<>, and set the ItemTemplate to my UserControl (easy so far) and then have it display horizontally in columns...
Very easy to do vertically with a ListBox but I need it horizontally...
____________________________________________________________
Be brave little warrior, be VERY brave
|
|
|
|
|
Not quite sure if I understand what you want to do, but couldn't you use a stack panel?
only two letters away from being an asset
|
|
|
|
|
Hi Mark,
Is it possible to bind a StackPanel? I don't see a ItemSource or ItemTemplate attribute either...
____________________________________________________________
Be brave little warrior, be VERY brave
|
|
|
|
|
ItemsControl has an ItemsPanel property. Set ItemsPanel to a template
containing a StackPanel with its orientation set to Horizontal.
There's an example in the ItemsControl.ItemsPanel Property docs[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark, thanks for the reply, will give it a try
____________________________________________________________
Be brave little warrior, be VERY brave
|
|
|
|
|
Ok, took some googling but got it, for any n00b like me who's going to read this, here's the XAML code:
<ItemsControl ItemsSource="{Binding Path=Columns}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" >
<SNeSControls:ActiveInfonMachineColumn Width="80"/>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"></StackPanel>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
____________________________________________________________
Be brave little warrior, be VERY brave
|
|
|
|
|
Hi
I am trying to achieve tricky binding behaviour from a treeview. I have a hierarchy of objects with the same base type. Some of these objects are of a derived 'leaf' type. I want to display the object hierarchy in a tree view with the leaf objects having a different data template from the rest of the branch objects.
The tricky thing I want to achieve is for the treeview to ignore all branches that do not have leaf objects in their subtree e.g. in this hierarhcy:
item1 - item3
_____- item4 - item6 - leaf1
__________________- leaf2
____________- item7
item3 and item7 would not be displayed as they have no leaves in their subtree.
Can this be achieved in XAML?
Thanks
Dan
|
|
|
|
|
I suggest you do that in MVVM. Here is an excellent article[^] describing how to use MVVM with a TreeView.
Eslam Afifi
|
|
|
|
|
I have taken your advice and written a view model layer which wraps my objects. However, I still have a problem:
All of the child lists of my underlying node objects are observable i.e. children can be added or removed at any time and the treeview needs to update. This means that a previously leafless node may suddenly gain a leaf in its subtree and so need to become visible. This means that I cannot simply cull leafless branches of the view model node tree - they need to be present but invisible in the tree view until a leaf is added. I have added a property 'HasLeavesInSubtree' to each tree node view model but have no idea how to use this in XAML to turn the display of these nodes on and off.
Thanks
Dan
|
|
|
|
|
Use a DataTrigger and set the visibility based on this.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|