|
I'm having a problem when loading the png file to image.source. It changes the resolution of png file. The expected is to retain the resolution of png file loaded/rendered on xaml tag.
Thanks,
Jaypee
|
|
|
|
|
Iam trying to configure a service for access over both https and http from a silverlight 4 application. I am able to access the service over https but not over http. I have made some research over the net but can't seem to get the configuration right.
Below is my current settings in the my web.config file.
<system.serviceModel>
<bindings>
<customBinding>
<binding name="MyhttpsBinding">
<binaryMessageEncoding/>
<httpsTransport/>
</binding>
<binding name="MyhttpBinding">
<binaryMessageEncoding/>
<httpTransport/>
</binding>
</customBinding>
</bindings>
<services>
<service name="MyData" behaviorConfiguration="MyData">
<endpoint address="" binding="customBinding" bindingConfiguration="MyData.customBinding.https" contract="MyData"/>
<endpoint address="" binding="customBinding" bindingConfiguration="MyData.customBinding.http" contract="MyData"/>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyData" >
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483646"/>
</behavior>
<behavior name="">
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
And below is my ServiceReferences.ClientConfig file
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="DataS" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="None" />
</binding>
<binding name="DataS1" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="None" />
</binding>
</basicHttpBinding>
<customBinding>
<binding name="CustomBinding_GetData">
<binaryMessageEncoding />
<httpsTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="//localhost/MyApp/Webservice/Data.asmx"
binding="basicHttpBinding" bindingConfiguration="DataS1"
contract="ServiceReference1.DataS" name="DataS" />
<endpoint address="//localhost/MyApp/Webservice/GetData.svc"
binding="customBinding" bindingConfiguration="CustomBinding_GetData"
contract="GetData.GetData" name="CustomBinding_GetData" />
</client>
</system.serviceModel>
</configuration>
What do i have mis-configured above that is making the calls to the service fail on http.
I cannot access the service via http but it works fine over https. And i have a requirement to support both https and http
|
|
|
|
|
Hi All,
Please help on the approach on how will I be able to create an WPF application with requirements below:
- The tool should allow the user to open an image file and draw rectangular areas on top of it that correspond to clickable portions of the image.
- Once the rectangular areas are already placed on top of image, the app will capture the Left, Top positions and Height and Width of rectangular areas.
|
|
|
|
|
I do wonder what your expectations for this message are?
Create a project
add a image control to the main form
add the controls to allow the user to select an image file
place the image on the form
create the controls to begin positioning the rectangles
record the position of the rectangles.
Just like you said!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I have a parent view with its own VM that contains a user control. The control allows the user to enter some data.
The user control's DP's & code are all I the code behind.
In the UC's code behind I created a Validate method that I want to call from the parent view's VM.
How do I do this?
If it's not broken, fix it until it is
|
|
|
|
|
I can think of 2 options, directly wire up the connection between VMs, breaks MVVM separation, ot use a message to fire the UC method.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I'm not happy with either of those approaches. A message doesn't let you return a value
If it's not broken, fix it until it is
|
|
|
|
|
Why does the Validate method have to be in the UC's code-behind? It sounds like it belongs in the VM.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
The user control doesn't have a VM. The code is in the Code Behind
If it's not broken, fix it until it is
|
|
|
|
|
But the main view does have a VM.
And the Validate method is presumably validating one or more properties on that VM.
And you want to call the Validate method from that VM.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
No, I want the VM to call into the UC. The UC is stand alone and should handle all it's own validation so it can be used in multiple places.
So I need to expose a method on it and call it from the parent view's VM.
If it's not broken, fix it until it is
|
|
|
|
|
Well, if you're not going to create a VM for the UC, and you need to return a value from the method, then you're stuck with hooking the method up to the VM somehow.
If you don't want to use the code-behind, then you might be able to get away with binding a delegate. (NB: I haven't tried this.)
UC's code behind:
public ValidationResult Validate() { ... }
public Func<ValidationResult> ValidationMethod
{
get { return Validate; }
}
VM:
public Func<ValidationResult> ValidationMethod { get; set; }
private ValidationResult CallValidation()
{
Func<ValidationResult> fn = ValidationMethod;
if (fn == null) return default(ValidationResult);
return fn();
}
View:
<ns:UserControl
ValidationMethod="{Bind ValidationMethod, Mode=OneWayToSource}"
/>
If the binding doesn't work, then you'll have to hook the method up from the code-behind of the view:
public MyView()
{
InitializeComponent();
DataContextChanged += OnDataContextChanged;
}
private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
{
var context = e.NewValue as MyViewViewModel;
if (context != null) context.ValidationMethod = theUserControl.ValidationMethod;
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Well, when do you want to call Validate? Generally, I'd say you'd call a Validate method when you leave the control. If that's the case, you don't need to call it manually, just have the control call it by itself.
|
|
|
|
|
What does 'Leave the control' mean??
The user clicks the 'Save' button on the tab's toolbar. This causes the parent VM's Save method to execute. It then has to call into the UC to save its changes.
Save changes calls Validate before saving.
There is no leaving the control. It's just validate before save.
If it's not broken, fix it until it is
|
|
|
|
|
I meant, "leave the control" as in lose focus. If you want to execute on a Save button, that's a different story. There are a few ways to do it:
1) use a composite command and have the control attach to it
2) use messenger and send a message (p.s. this does not require a VM unless your messenger service is tightly coupled to ViewModelBase which it shouldn't be)
3) get a reference to the view in your viewmodel and reference the control directly
4) use a bindable property to trigger the validation (this is probably the cleanest way). I.e. in your save method:
ValidateControl = true;
the control would need to expose a DP and call Validate() when its set to true, then afterwards reset it to false.
Or, if you don't have control over the control, then an attached property would accomplish the same thing.
|
|
|
|
|
I agree - the DP is probably the cleanest, easiest way to do this.
Many thanks
If it's not broken, fix it until it is
|
|
|
|
|
I would create a VM for the UC. The parent VM then instantiates the child VM and has a reference to it so can access it's methods.
So any other control that needs to use the UC can instantiate its VM and Bob's your uncle.
PooperPig - Coming Soon
|
|
|
|
|
Generally, I write controls with code behind. Making a VM for a reusable control kinda ties you into an MVVM framework. I like to re-use my controls across apps.
|
|
|
|
|
I want to send a fax using wpf. using rdlc report can we send a fax or not. Thanks in advance
modified 25-Jul-14 5:47am.
|
|
|
|
|
|
Pete O'Hanlon wrote: Use TAPI.
Don't you need a hmm what is that thing, oh yeah a modem to use that.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
You can Google it using the term "sending fax using C#".
They'll provide you with a code or a tutorial and you can then use it in your software.
Favourite line: Throw me to them wolves and close the gate up. I am afraid of what will happen to them wolves - Eminem
~! Firewall !~
|
|
|
|
|
Hi
I have created a class called DatePickerEx.cs that inherits from DatePicker class. Then I created a UserControl called CustomDatePicker.xaml that references the DatePickerEx.cs class in the xaml code.If I bind the "selecteddate" property in xaml at this point, it works good. So far so good.
Now, I reference the CustomDatePicker.xaml usercontrol inside another UserControl, at this point I have no way to set the "SelectedDate" property on the new UserControl called CustomDatePicker.xaml, can someone explain me how can I expose the DatePickerEx.cs->DatePicker.cs SelectedDate property via the new userControl CustomDatePicker.xaml to any other consumers of CustomDatePicker.xaml.
I need to use some kind of Dependency Property to achive this?
Your help will be highly appreciated.
Thank you.
happy coding!
|
|
|
|
|
If you did public class DatePickerEx : DatePicker, then you'll get all the public properties and methods of DatePicker. If that's not working, you did something wrong . Not sure what since you didn't post what errors you are getting or any code.
|
|
|
|
|
in my application WPF/C# , i have a simple TreeView "treview1" that content for exemple:
*item1
* item1.1
*item2
* item2.1
Now i have an Class "Search.cs", and within this Class i have some methods like: advanced_serch and simpl_search , I want to be able to modified my TreeView in this two methods(advanced_serch and simpl_search).....
How i can dos this???
Please help me !!
|
|
|
|