|
Piyush Vardhan Singh wrote: how to run application successfully without change
You can't. You have to change the endpoint address to match the host.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
how it possible to change endpoint the address for every client...
Piyush Vardhan Singh
p_vardhan14@rediffmail.com
Eventure Technology
http://holyschoolofvaranasi.blogspot.com
http://holytravelsofvaranasi.blogspot.com
|
|
|
|
|
Typically servers are set up so they are reachable using the same address
from anywhere. For example, http://www.codeproject.com
Your server-side endpoint address is going to need to be different when
the app is deployed. The client side address needs to be changed to reach the
server at its deployed location.
I have no idea how you've deployed your service and to what type server, but
for example "http://localhost..." won't be in the address of a service endpoint
deployed on IIS.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello,
I have a treeview in expander in my wpf project..
I am using hierarchical datatemplate (which have arrow image and textblock) for treeview databinding.
I am using style triggers for changing selected node's fonts to bold..
Now upto this all things working fine, but after selecting particular node(either child or parent) when i collapsed my expander control and expand it again, background for textblock will be gray..
Any idea??
|
|
|
|
|
Last selected Item of treeview control will display the gray color, on expand of expander for the reason it represent disabled selection.
Select an item in treeviewcontrol, and then click outside the preview of treeviewcontrol to trigger lost focus of treeviewcontrol, the selected item will be gray.
<Style x:Key="TreeViewItemItemTemplateStyle" TargetType="{x:Type TreeViewItem}">
<Style.Resources>
<!-- Background of selected item when focussed -->
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Blue" />
<!-- Background of selected item when not focussed -->
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="LightGray" />
</Style.Resources>
</Style>
you can override the gray color by applying the color you want for not focussed style.
|
|
|
|
|
If anyone can tell me how to place images in a dll and access them from a WPF exe, I would appreciate it. Everything I've tried online, I get error messages that the file cannot be found.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
I've just created a class library and added a resource file (from the project properties) and set its Access Modifier to public. The resource contained a PNG file. In the WPF project, I added references to the class library and System.Drawing (since it returns Bitmap).
Then loaded the image like this, var img = ClassLibrary1.Properties.Resources.Image1;
You can then use System.Windows.Interop.Imaging to convert to BitmapSource.
If you're talking about resource dictionaries, I found this[^] and I'll try tomorrow to see if there is another way to do it.
Eslam Afifi
|
|
|
|
|
Thank you. I've tried doing it the WPF way and it plain does not work, so I expect this is the sort of thing I am going to end up doing. Just so ugly to have to convert an image to an image ( as it where ) because the whole setup is so badly designed. I wonder if it's even possible to load these images from a dll in XAML, every example I've seen online, plain does not work.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
I have managed to do it in XAML.
In the class library, add a XAML file (or drag and drop from an existing WPF project). Don't forget to set its Build Action to Page.
<ResourceDictionary x:Class="Resource1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<BitmapImage x:Key="img" UriSource="Resources\Image1.png" />
<SolidColorBrush x:Key="greenBrush" Color="Green" />
</ResourceDictionary>
And add a class in the library, the code is similar to the one found in App.g.cs
public partial class Resource1 : ResourceDictionary
{
private bool _contentLoaded;
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
public void InitializeComponent()
{
if (_contentLoaded)
return;
_contentLoaded = true;
System.Uri resourceLocater = new System.Uri("ClassLibrary1;component/Dictionary1.xaml", System.UriKind.Relative);
System.Windows.Application.LoadComponent(this, resourceLocater);
}
public Resource1()
{
InitializeComponent();
}
}
Add a reference to the library in the WPF project, and add the resource dictionary anywhere (for example Application.Resources. Don't forget to add the XML namespace.
<Application x:Class="WpfApplication1.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:lib="clr-namespace:ClassLibrary1;assembly=ClassLibrary1"
StartupUri="Window1.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<lib:Resource1 />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
Now you can use it in XAML just like any resource dictionary.
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300" Background="{StaticResource greenBrush}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Image Source="{StaticResource img}" />
</Grid>
</Window>
And also access them from code,
var brush = this.TryFindResource("greenBrush");
var imgWPFStyle = Application.Current.TryFindResource("img");
And I agree with you that the InitializeComponent code should be automatically generated by visual studio. But until they add that feature, it's not hard to copy and paste that code snippet.
And you're welcome.
Eslam Afifi
modified on Friday, April 17, 2009 3:53 PM
|
|
|
|
|
Hi, Cristian!
Usually the best way to cure this sort of errors is to open the assembly you are loading resource from in the Refelctor and to see at the resource name. The resource name in your code must match exactly the name the Reflector will show. It will be all lowercase and can be qualified by the directory name where your resource is stored in the resource assembly.
I hope when requesting the resource you reference the assembly which contains this resource.
Regards,
Oleg V. Polikarpotchkin
ovp
|
|
|
|
|
I am doing all of that, and it plain does not work. I also wrote code to load the images, and found that does not work either. I call a method in my dll, and if I put the dll name in the Uri, it returns an empty image. If I don't, it blows up. Talk about lousy design, someone at MS is smoking crack.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Well, really you can get the image from the foreign class library and show it in the WPF Image control with just one line of code. Look at the sample I've uploaded for you here.
Regards,
Oleg V. Polikarpotchkin
ovp
|
|
|
|
|
The simplest way I know:
<Image Source="/WPFTesterResourceLib;component/Images/Airplane.png" />
where Airplane.png is in a folder called Images in the WPFTesterResourceLib project and
has its Build Action set to Resource and the Custom Tool setting blank.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
first,see post http://bea.stollnitz.com/blog/?p=21 please.
in a factual application , this is very useful!
for describe clear ,add a new table into the database
the new table have tow field: Run_ID , Value1(type int). The Run_ID is the key of the table.
I want bind the new table to a datagrid in a silverlight application.
the datagrid have four columns:
1: Mountain_Name, represent as a combobox
2: Lift_Name, represent as a combobox
3: Run_Name, represent as a combobox
4: Value1, represent as a textbox
all columns is modify able.
the column 1 to 3 is Synchronized like as in the post http://bea.stollnitz.com/blog/?p=21
how I do this ?
and how set the column 1 to 3 when load the table into datagrid?
thaks very much!
|
|
|
|
|
hi guys
i have my dll , in which there are my domain objects , there are some classes
1- Employee
2- Student,
do i have to make all of them labeld with datacontract and datamemebr attributes if i want to
make available those classes to my WCf Client .
Thanks in advance ,
Tauseef A Khan
MCP Dotnet framework 2.0.
|
|
|
|
|
ghumman63 wrote: datacontract and datamemebr
The short answer is yes, if I understand your question. The DataContract describes how the object is serialized. The DataMember specifies that the member is part of the contract and is serializable.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
but still i can use them without these attributes ,
i have a reference to this library in my client and i can deserialize it easily so where is data contract and data member , i am confused ,
thanks in advance
Tauseef A Khan
MCP Dotnet framework 2.0.
|
|
|
|
|
ghumman63 wrote: where is data contract and data member
I guess I do not understand your question.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
i meean to say , i didnt use datacontract attribute but still i can
deserialize my objects at my client by just adding the reference of my domain DLL like
dim emp as employee = Servicereference.GetEmployee("staffno")//client code
in my wcf service class employee is not marked as datacontract , thats why i am confused that
in which case i need to mark it with datacontract attribute.
thanks in advance.
Tauseef A Khan
MCP Dotnet framework 2.0.
|
|
|
|
|
ghumman63 wrote: i need to mark it with datacontract attribute
As Pete said. You mark the class with a DataContract attribute when you are sending the object through WCF from host to client or from client to host. When the object is sent from one to the other, the object is serialized when sent, and deserialized when it gets to it's destination. The DataContract tells WFC how to serialize the object and how to deserialize it.
In your example, you are directly instatiating the class not deserializing it.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
You can use them directly, but you need them if you want to marshall them "over the wire" using the internal WCF communications layers. Basically, these define parts of the Contract, which forms part of the basic tenet of WCF:
A = Address
B = Binding
C = Contract
Or, to put it another way; A = where the service is hosted; B = the mechanism you're going to use to communicate with it and C = the data and methods that you are going to interact with on the service.
"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
|
|
|
|
|
i meean to say , i didnt use datacontract attribute but still i can
deserialize my objects at my client by just adding the reference of my domain DLL like
dim emp as employee = Servicereference.GetEmployee("staffno")//client code
in my wcf service class employee is not marked as datacontract , thats why i am confused that
in which case i need to mark it with datacontract attribute.
thanks in advance. nkh
Tauseef A Khan
MCP Dotnet framework 2.0.
|
|
|
|
|
hi guys
i am very much new to WCF , actually the issue is that i have a seperate dll for my domain objects named "MYDomainObjects" , i add a reference into my wcf services and create a method which returns
object of type of Employee which is a class in ""MYDomainObjects",
on client i create a wpf client and add a reference to my ""MYDomainObjects""
and call the method and get values into my client side Employee object , but i am confued where
is now datacontract and data member , because it is said that we have to use data contract for our
complex types to be serialized ,, i hope you will understand my concern , thanks in advance ...
Tauseef A Khan
MCP Dotnet framework 2.0.
|
|
|
|
|
I used image-gallary download form codeplex.com on my project. It was very very slow to open a picture. I did same throught flash, it is much faster.
Can any body tell me how to speed up silverlight application to better than flash as it can get data of my asp.net and process it, flash is harder to work for such manner. I want to use silverlight because of easily support with c# and asp.net
|
|
|
|
|
There's no reason Silverlight should be significantly slower than Flash
opening a picture.
Without any details on what you're doing, it's difficult to help
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|