|
So each version of Silverlight that comes out I take a look and see how the technology is progressing. I finally got to SL4. This may be user error but I'm really frustrated with the data access. I first tried POCO, using my own objects from the server. Got those passed through WCF and bound but then you can't use the DataAnnotations (I like the ID of having the validations for the data where the data lives in the class) when you bind on the client. Then I went to the WFC Data Service model using MVVM. Looked good but then guess what, same issue. Lastly I went to RIA but couldn't figure out how to add an object on the client. Evidently MS didn't build my Insert function on the Domain Service. So I went to go look for myself. So many generated functions with odd attributes my eyes hurt. I’ve looked at videos which all simply just edit objects but don’t add anything. But if they would I can get the DataAnnotations working with RIA but I have to do this kludgy Metadata object.
So is there a better way or am I doing something wrong? I hate MS generated black boxes because they tend not to work for real applications and then when something does go bump in them you spend hours on google researching only to find out you are so in bed with them you have to wait till next release to get it fixed. I’m just about to create my own Data layer architecture for working with SL but before I do I thought I would do a sanity check with the guru’s. What did I miss? Is there a better way?
|
|
|
|
|
WCF RIA Services will give you the most RAD help with dataannotations.
The metadata object may seem kludgy but it's not so bad. The code it is decorating is Visual Studio generated code that you shouldn't edit anyway so it doesn't really make a difference because you're not editing same code in more than one place.
You're still responsible for adding CRUD operations to the service yourself, so if the default generated code doesn't include an insert method then you simply add one yourself. Generally you'll end up adding lots of variations on insert, delete, and add service methods.
And there's no black box here. All the generated code is part of your project.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
There never was a chance that we would use RIA, for the same reasons you iterate, black box, MS defined and constrained functionality etc. We built our own, first building a code generator (modified the existing one which began life in VB5) to service the WCF requirements. This is basically simple boilerplate code for the object and CRUD work.
This pushes 90% of our work into the VM and View, where we have some really cool snippets that eliminate all the donkey work and leaves us with the difficult stuff like making the dammed view do as it is told!
It is painful getting a design idea wrong, you should see the crap we (I) created around dialog management before I got a handle on the child window concept.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I am looking to use the shape functionality in WPF in order to apply two triangles one pointing up and the other pointing down along with the plus sign to some buttons. Having a look there doesn't seem to be an easy to do this. Does anyone have an example where this can be easily done?
Thank
|
|
|
|
|
Check out the Path class. Triangles and plus signs are easy
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
An easier way is to use an appropriate font. Triangles are just "y" in Wingdings 3.
|
|
|
|
|
Yes, for WPF apps one can use the Font but if he wants to use it for Silverlight, he has to create the shape using Path control.
Silverlight 5 Tutorials : 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
|
|
|
|
|
Member 2972992 wrote: two triangles one pointing up and the other pointing down along with the plus sign
It will be easier is you have Expression Blend Installed,the pen tool allow you to draw shape and you can convert a plus in text format to shape
|
|
|
|
|
If I have:
Dictionary<string, Dictionary<int, TestStruct>> _dict = new Dictionary<string, Dictionary<int, TestStruct>>();
and want the top level nodes to be bound to Key and the underneath nodes to be bound to Value.Name (from TestStruct), I have the following HierarchialDataTemplates:
<HierarchicalDataTemplate x:Key="TopLevelTemplate" ItemsSource="{Binding Value}">
<TextBlock Text="{Binding Path=Key}" />
</HierarchicalDataTemplate>
<HierarchicalDataTemplate x:Key="SecondLevelTemplate">
<TextBlock Text="{Binding Path=Value.Name}" />
</HierarchicalDataTemplate>
I got it to work with a data template selector like this:
public override DataTemplate SelectTemplate(object item, DependencyObject container)
{
FrameworkElement element = container as FrameworkElement;
System.Type t = typeof(System.Collections.Generic.KeyValuePair<int, TestStruct>);
if (item.GetType() == t)
return element.FindResource("SecondLevelTemplate") as DataTemplate;
return element.FindResource("TopLevelTemplate") as DataTemplate;
}
but that kind of seems hacky... is there a way to get generics going in the HierarchialDataTemplates?
I know the usual solution is to do something like:
public class ItemCollection : List<TestStruct>
and use ItemCollection everywhere, but that doesn't really work with Dictionaries, since you are still getting KeyValuePair(K, V) from the enumerator.
|
|
|
|
|
Good Day All
i have placed a CrossDomain and the ClientPolicy Files in the Root of the IIS directory wwwroot.
We are currently having a problem on our side, our Network administrator says he has opened port 80 , but those policy files are not accessible from outside.
i change the port of my site to 8081 and the site is fine, but it needs to policy files that are accessible through port 80.
i goolged a bit and i see some people trying to programatically change the address location of the policy file.
You see the policy files that i can access , i can access them if i entered the port, and IIS looks for the policy Files in the Root Directory and those are accessible with port 80.
There are two things that i can settle for.
1) Its either the port 80 issue is resolved
2) The Policy files should be accessible via the new port.
I used Fidler to inspect this and i have the results in the attachment
http://www.tiyaneproperties.co.za/FidlerResults.png[^]
I need advice.
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
The port number is part of the domain and the client should be requesting the policy file at the same domain as the connection attempt. Are you sure it's requesting the file on port 80 or have you not configured the client to connect to the new port?
And why isn't the policy file accessible from outside on port 80?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
hi Mark it was accessing it on port 80, we have installed a new Server and now it is working, there was something that was blocking it.
thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
How to hide/remove a wpf system tray application from alt+tab dialog?
- Regards - J O N
A good thing is a bad thing if it keeps you from the best thing. - Dr. Adrian Rogers
|
|
|
|
|
Setting the main window Visibility = System.Windows.Visibility.Hidden hides it for me on Windows 7.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Is it possible to navigate from a child page to another child page when the navigation frame is in the main page.
|
|
|
|
|
Using the NavigationService might help[^].
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
Hello!
I am developing a program. sometimes, i need to view something in a WebBrowser (using WindowsFormsHost or Awesomium)
I want to glass somewhere of my window (in webbrowser)
in winForms, I can make it black and it will glass inside browser (i think), but in WPF, I can't set a color inside webbrowser in black.
So, How do I glass something in WebBrowser (using WindowsFormsHost or Awesomium) in WPF?
Regards.
Mehdi Ghiasi
|
|
|
|
|
A cruel suggestion will be to add a border control on top of your web browser and set the background value to black with opacity of about 60%. You will have to control the visibility of this border control from code.
|
|
|
|
|
Hello,
Some time ago, my Visual Studio 2010 for some bizar reason would never be able to have IntelliSense find my 'LayoutRoot' in my Page1.xaml.cs file. Now recently, I looked at my .xaml file and removed some tags and now LayoutRoot shows up magically for some reason.
Could it be that 'LayoutRoot' won't show unless I have valid xaml? I remember that my prof told me it was my own responsibility for my machine working, and during the whole exam I couldn't get that darned 'LayoutRoot' to popup in IntelliSense.
I would like to know exactly what happened in my VisualStudio that made the LayoutRoot pop up again and what would prevent it from popping up.
Thank you
//Edit: I fixed it. My .xaml page had to have its 'Build Action' property set to 'Page' and not 'ApplicationDefinition'.
modified on Monday, July 11, 2011 6:37 AM
|
|
|
|
|
hello guys... I wanna know that whats the difference between the ADO.NET we use in silverlight and the one we use in Windows(Web) applications? How do they differ in usage (strategy), why dont we just use the simple ADO.NET of windows apps? Why we need a different machanism?
|
|
|
|
|
Well you don't use ADO in Silverlight, you can't the whole data assembly is excluded from SL assemblies. You have to supply the data via WCF. In the WFC you use ado.net just the same as the winforms, you just can't send a datatable/set to the Silverlight client. You need to serialise it, we use List<object> proxies.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
In addition to the other reply...
Silverlight apps run on the client in a browser, and except in certain circumstances, run with restricted privileges, making direct access to databases impossible.
As mentioned, ADO.NET should be used on the server, and the Silverlight client can use something like WCF[^] or WCF RIA Services[^] to transfer data to/from the server.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Well there is no ADO.Net in Silverlight.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
ObservableCollection is binded to ItemsControl and PropertyChange fired on CultureChangedEvent though the items in collection remains the same. This doesnot update the DataTemplate/ItemTemplate. I guess WPF ignores because no change made to the item collection. How do i force a refresh on DataTemplate? i had tried BindingExpression.UpdateTarget().
similar problem is addressed at this Link[^] but the recommended approach didn't work.
any idea?
- Regards - J O N
A good thing is a bad thing if it keeps you from the best thing. - Dr. Adrian Rogers
|
|
|
|
|
Have you tried raising a Reset notification on the collection?
|
|
|
|