|
fred_ wrote: The client Silverlight app still denies the connection to the server socket.
Any exception?
The only thing I can think of is the Silverlight app doesn't like the
returned policy file - either it's malformed or it doesn't permit connections
on the port the Silverlight app is trying to connect to.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I'm trying to do DataBinding in XAML woutout any coudebehind. However I can't find any of the nice Binding features found on most other WPF controls.
What is the most current and prefered way to do databinding on RadioButtons ?
|
|
|
|
|
hhrafn wrote: I can't find any of the nice Binding features found on most other WPF controls
Which properties of the RadioButton control are you
trying to bind to that are missing "the nice Binding
features"?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
well, I'd like to use the radio buttons like this: (in theory at least)
<RadioButtons ItemsSource="{Binding Colors}" />
Then picking up the selected item through a selectedItem binding (?)
Basically my problem is that I need it to be MVVM (no codebehind) and this radio button list will also be dynamic (changeable).
|
|
|
|
|
Well, a RadioButton is not an items control, and I have never heard of a "RadioButtons" control. You might try using an ListBox to allow you to bind the ItemsSource and make a RadioButton in the ItemTemplate. The tricky part will be binding the IsChecked of the RadioButton to the IsSelected on the ListBoxItem.
|
|
|
|
|
In addition to Gideon's reply...
Why are you hung up on not using code behind? What's the difference
between code generated from the XAML and code you write? It's the
same class either way.
You could provide individual bool properties to bind the IsChecked
properties of each radiobutton to.
You could also use a converter to modify the IsChecked properties of the
radiobuttons into some other form, like an enum etc.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm not sure if I totally understand your requirement, however you can certainly use MVVM to support a radio button list. Take a look at "Creating an Internationalized Wizard in WPF" [^], in particular the section "Presenting Options via OptionViewModel". In this example the OptionViewModel is used for CheckBox options and RadioButton options. BTW it can be extended for a Combobox - you will see my thread in the discussions for the article, and Karl's solution.
I hope this helps.
Tim
|
|
|
|
|
Thank you, this solution looks perfect for me
My main requirement in this project is to follow the MVVM pattern, or "total" seperation of View and Code (control).
Thanks again.
|
|
|
|
|
I am new to silverlight and I need to throw the data from the database into real time graph using silverlight technology, pl suggest me how can I achieve this?
|
|
|
|
|
Using WPF, while following the MVVM pattern, I'm constructing a digital version of a paper form.
This paper form has many fields that need to be filled out.
The fields are basicly boxes with the title of the field inside it, then you write the appopriate data into the box.
I was wondering if I should use a UserControl to solve this repedative taks of all these many boxes. All with different titles and data, but having basically the same look.
So I constructed a UserControl with one Label (name="Title") and a TextBox (name="Text").
Now, if I have a ViewModel as DataContext for the form window (which contains all of these UserControl-fields, how can I bind the properties of the ViewModel to the content properties of the Lable and TextBox?
I'm hoping I won't have to add any codebehind to the UserControl just to make Properties.
Is there some nifty thing I can do here?
Am I on the right path even, should I perhaps just stick to datatemplates somehow ? .. or just make one huge form with many many manu labels and textboxes ?
|
|
|
|
|
hi to all.....
plz help me in....how to design page navigation window form using back and next button......for exmple...if we take a window like install wizard window..in that v use a button name as next.. for go through the next step...like ....sooo can u any one send me that source code...
|
|
|
|
|
hi to all.....
plz help me in....how to design page navigation window form using back and next button......for exmple...if we take a window like install wizard window..in that v use a button name as next.. for go through the next step...like ....sooo can u any one send me that source code...
@nu Gunturi
|
|
|
|
|
|
Error passing List as a parameter to web service
This is my second post on the same subject, in an attempt to solve the same problem. I hope this time I've supplied enough and correct information. Given a basic service, it is possible to return a List from the web service using the GetList() method but the compiler gives an error when trying to send the list as a parameter in the SendList() method. Please check the code bellow. I've revised it.
The error is on line # 88 (The compiler error description is at the end of the source code)
Note: I've configured the ServiceReference to return System.Collections.Generic.List although I've tested all possible combinations.
1 namespace SilverlightApplication1.Web
2 {
3 [ServiceContract(Namespace = "")]
4 [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
5 public class Service1
6 {
7 [OperationContract]
8 public List GetList()
9 {
10 // Add your operation implementation here
11 List myList = new List();
12 myList.Add(new People() { name = "AAA", age = 42 });
13 return myList;
14 }
15 [OperationContract]
16 public string SendList(List myList)
17 {
18 return myList[0].name;
19 }
20 }
21
22 public class People
23 {
24 public string name;
25 public int age;
26 }
27 }
28
29
30 "SilverlightApplication1.Home"
31 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
32 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
33 xmlns ="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
34 xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
35 mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"
36 Title="Home"
37 Style="{StaticResource PageStyle}">
38
39 <grid x:name="LayoutRoot" >
40="" <scrollviewer="" style="{StaticResource PageScrollViewerStyle}" >
41=""
42="" <stackpanel="" >
43=""
44="" <textblock=""
45="" text="Home">
46 <textblock x:name="ContentText" style="{StaticResource ContentTextStyle}"
47="" text="Home page content">
48
49
50
51
52
53
54
55
56
57
58
59
60 namespace SilverlightApplication1
61 {
62 public partial class Home : Page
63 {
64 public Home()
65 {
66 InitializeComponent();
67 }
68
69 private void btnGetList_Click(object sender, RoutedEventArgs e)
70 {
71 ServiceReference1.Service1Client proxy = new SilverlightApplication1.ServiceReference1.Service1Client();
72 proxy.GetListCompleted +=new EventHandler<silverlightapplication1.servicereference1.getlistcompletedeventargs>(proxy_GetListCompleted);
73 proxy.GetListAsync();
74 }
75 // THIS WORKS
76 void proxy_GetListCompleted(object sender, SilverlightApplication1.ServiceReference1.GetListCompletedEventArgs e)
77 {
78 MessageBox.Show(e.Result[0].name + " " + e.Result[0].age.ToString());
79 }
80
81 private void btnSendList_Click(object sender, RoutedEventArgs e)
82 {
83 List<people> myList = new List<people>();
84 myList.Add(new People() { name = "AAA", age = 42 });
85
86 ServiceReference1.Service1Client proxy2 = new SilverlightApplication1.ServiceReference1.Service1Client();
87 proxy2.SendListCompleted += new EventHandler(proxy2_SendListCompleted);
88 proxy2.SendListAsync(myList); // COMPILE ERROR SEE DESCRIPTION BELLOW
89 }
90
91 void proxy2_SendListCompleted(object sender, SilverlightApplication1.ServiceReference1.SendListCompletedEventArgs e)
92 {
93 throw new NotImplementedException();
94 }
95 }
96
97 public class People
98 {
99 public string name;
100 public int age;
101 }
102 }
103
Error 2 Argument '1': cannot convert from 'System.Collections.Generic.List<silverlightapplication1.people>' to 'System.Collections.Generic.List<silverlightapplication1.servicereference1.people>' e:\SilverlightApplication1\Views\Home.xaml.cs 42 34 SilverlightApplication1
Error 1 The best overloaded method match for 'SilverlightApplication1.ServiceReference1.Service1Client.SendListAsync(System.Collections.Generic.List<silverlightapplication1.servicereference1.people>)' has some invalid arguments e:\SilverlightApplication1\Views\Home.xaml.cs 42 13 SilverlightApplication1
|
|
|
|
|
I think the problem is that the People objects that you are trying to send are defined on the client side. The service is expecting the People objects that are defined on the service side - they are not the same thing.
Try sending a list of ServiceReference1.People instead of SilverlightApplication1.People and see if you get the same error.
|
|
|
|
|
In addition to Nigel's reply...
Since you're using the automagic proxy generator, then you
can look at the generated code on the client side:
1) Click on the client project in the Solution Explorer
2) Click the "Show All Files" button on the Solution Explorer's toolbar
3) Drill down the files tree from the service reference to find the
Reference.cs file - that will have the generated client-side classes
In the generated code, there should be the People class you should be using.
If it's not there, try using the DataContractAttribute on the server side:
[DataContract]
public class People
{
[DataMember]
public string name;
[DataMember]
public int age;
}
(don't forget to update the service reference on the client to get new
generated code!)
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark,
It is there. Thanks for the extra info (Being able to look at the generated client-side class is really usefull) The problem is solved. Nigel's post was right. I apologize that I didn't mentioned it on the previous thread. But, there are 2 things I learned, besides these ones.
1. Starting with Net 3.51 it is not necessary to add the [Data Contract] anymore for know types.
2. It appears that SL 3 web services do not require to implement the interface
|
|
|
|
|
Hello To All,
I have developed a WPF Browser Application that captures webcam and broadcasts to to the persons in the list-box.
My problem is i m able to broadcast my webcam but when i see other webcam it shows me mixed streaming of both webcam 's .
One more problem is when two webcam get connected it gets very slow.
public void ShowVideo(Stream stream)
{
try
{
using (System.Drawing.Image objimage = System.Drawing.Image.FromStream(stream,true))
{
Bitmap objbitmap = new Bitmap(objimage);
MemoryStream str= SetImageSize(objbitmap);
Bitmap bitnew = new Bitmap(str);
IntPtr hBitmap = bitnew.GetHbitmap();
BitmapSource bmpSrc = Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero,
Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
DeleteObject(hBitmap);
imageOnlineUser.Source = bmpSrc;
if (this.ConnectDisconnect == false)
{
btnVideoShare.IsEnabled = false;
}
stream.Flush();
stream.Dispose();
GC.Collect();
}
}
catch (Exception ex) { }
}
I m using above method to show my webcam.
Please Help Me.
With Best Regards
Hardeep Singh Bhullar
Hardeep Singh Bhullar
|
|
|
|
|
how can i create a window with may user control ? and how do i connect them with each other?
modified on Monday, October 19, 2009 7:36 AM
|
|
|
|
|
nerra wrote: How can i create a window that has many user control ? and how do i connect this
You start by learning the language that you wish to use, usually by buying a book and studying hard. When you have a problem with your program you can post a question here and ask for help.
|
|
|
|
|
I appreciate your answer but there is no available book here in my country. If i buy it online i can't afford it. Thank you for your answer
modified on Monday, October 19, 2009 6:16 AM
|
|
|
|
|
nerra wrote: I appreciate your answer but there is no available book here in my country. If i buy it online i can't afford it. Thank you for your answer
According to your homepage your country is USA where you can buy books on every subject you may need. Secondly if you cannot afford to buy a book then I suggest you try some of the tutorials on the internet as you obviously have access to that. There are hundreds of articles here on The Code Project, and other sites, to get you started.
Your question is far too general for anyone here to give you a simple answer, you must do your own work first.
|
|
|
|
|
oh I'm sorry i did not notice that my country was in USA i will change it immediately sorry for the confusion sorry .... I may have an internet it is not good for playing video though .... again i an deeply apologize for the confusion of the country post homepage... I am not looking for a debate ...I appreciate that you have concern about my study habit... if you think this is just a shallow question then i will delete this thread after i figure how i can delete it... again i thank you and i apologize for the confusion
|
|
|
|
|
nerra wrote: if you think this is just a shallow question
No, your question is fine. I was just trying to explain that what you are asking for cannot be answered in a forum like this, as it would take too long. If you read some of the introduction articles on the subject of your choice they will show you how to do the things you want to learn. Then when you find something that you have difficulty understanding, or that does not seem to work, you can post a question and people will try to help.
|
|
|
|
|
I understand thank you i'll just try searching for more resource
|
|
|
|