|
Hi,
I want to build my WPF project for Class Library Type/Windows Application Type. Its working for Windows application but not working for WPF application, kindly help me.
|
|
|
|
|
Eh? What? Do you mean that you want your application executable to reside inside a DLL and you want another piece of code kick off your application?
|
|
|
|
|
I have single project, When i set Project output type to class library it should generate DLL and when i set Project output type to Windows Application then it should generate exe.
|
|
|
|
|
Yes. That works for WPF as well. What exactly are you seeing?
|
|
|
|
|
Thanks for your reply.
I see this errors for WPF Application:
Error 1 Library project file cannot specify ApplicationDefinition element.
Error 2 The project file contains a property value that is not valid.
|
|
|
|
|
Remove the App.xaml and App.xaml.cs files. They are, effectively, the entry point for a WPF executable and they are not needed in a class library. The build type of App.xaml is ApplicationDefinition.
|
|
|
|
|
Oh thanks Pete O'Hanlon, its working fine.
One thing i want to put here: if I don't remove the App.xaml and App.xaml.cs file, and Change Build Action from ApplicationDefinition to Page then also it works.
Thanks
|
|
|
|
|
It does, but the App.xaml makes no sense inside the class library.
|
|
|
|
|
Yes you are correct, it doesn't make sense in class library. But my requirement is sometime I need DLL and sometime EXE, so I am not removing App.xaml file.
|
|
|
|
|
That's just really weird, and not a requirement, it sounds like a solution to another requirement.
The 'normal' way would be move the common bits to a class library, then you have an exe that references that library.
You don't switch an exe to dll just by changing the project setup or visa versa.
|
|
|
|
|
It's not weird, if I want reference the DLL in multiple exe other than the exe which is generated from by changing project output type Windows Application.
|
|
|
|
|
If you want to reference the dll from multiple exe's(or other dll's) then that's exactly what a class library is for.
Why do you think you now need to change that same class library to an exe? what is the exe going to do?
|
|
|
|
|
This library contains XAML file, if I make exe of it then doesnt required to add reference of DLL.
|
|
|
|
|
Not sure I get you... but if you want a class library to contain xaml (Windows, Pages, UserControls etc) then it can do, and yes you might need to manually add some references to the default 'class library' visual studio template.
If you create a WPF app then obviously the template already contains all the basic references you need.
You still don't need to switch a single project between a class lib and an application types.
|
|
|
|
|
I want to add a table to a DockPanel. Please see the table demo.
The text are all hardcoded or variables in the code. All the numbers are from code, say fields.
What should I select, datagrid or grid or table.
Thanks for code snippet.
|
|
|
|
|
You need to use a data table, bind the ItemSource to your collection and define the DataColumns with Header and Binding
<DataGrid Grid.Row="1"
Name="dgDB"
AutoGenerateColumns="False"
CanUserAddRows="False"
ItemsSource="{Binding DatabaseList}"
SelectedItem="{Binding SelectedDatabase, Mode=TwoWay}"
Margin="15"
IsReadOnly="True"
MouseDoubleClick="GridClick">
<DataGrid.Columns>
<DataGridTextColumn Header="Database"
Width="*"
Binding="{Binding DatabaseName}" />
</DataGrid.Columns>
</DataGrid>
Instead of Row="1" you would use DockPanel
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi, the data is not from database. Just several values, say:
IVR-Success=50;
IVR-Fail=2;
PAYMENT-Success=30;
PAYMENT-Fail=0;
CALL-Success=100;
CALL-Fail=2;
The total can be calculated. Just 3x3 table, no more rows or columns. Is it too complicated by using datagrid?
|
|
|
|
|
zhshqzyc wrote: Is it too complicated by using datagrid
Yes, the content is not dynamic so just place the labels and textboxes where they look good and bind each one to a single property in the VM.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hello
I have change the value in the web.config to connect my project silverlight to database but I have this problem on this line:
public Viaccess.Vite.AdministrationSL.SvcAdmin.WcfResultOfArrayOfPackageBOx8pdn48J EndGetAllPCKs(System.IAsyncResult result)
{
object[] _args = new object[0];
Viaccess.Vite.AdministrationSL.SvcAdmin.WcfResultOfArrayOfPackageBOx8pdn48J _result = ((Viaccess.Vite.AdministrationSL.SvcAdmin.WcfResultOfArrayOfPackageBOx8pdn48J)(base.EndInvoke("GetAllPCKs", _args, result)));
return _result;
}
And the message is "The remote server returned an error: NotFound".
The project use WCF.
Thanks
(Sorry I'm french and my English is not very good)
|
|
|
|
|
No one is going to be able to help you with so little information and setting up a WCF config is difficult. What I do is to split the project into 2, WCF and UI.
I then build the wcf and run it locally and test the connection using the Wcf Test Client and pull back the GetData.
I then change the web config and include the client access policy and cross domain xml files. Youwill need to find a couple of decent examples to work from, this is my config file
="1.0"="UTF-8"
<configuration>
<configSections>
</configSections>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpRuntime maxRequestLength="40000"/>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm" />
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicBinding"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="64"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="4096"
maxNameTableCharCount="16384" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="XXXPSsvcBehavior"
name="XXXPS.WCF.XXXPSsvc">
<endpoint address="XXXPSWCF"
bindingConfiguration="BasicBinding"
binding="basicHttpBinding"
contract="XXXPS.WCF.IXXXPSsvc" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="XXXPSsvcBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<directoryBrowse enabled="true" />
</system.webServer>
<appSettings>
<add key="DBServer" value="ServerName.arvixe.com" />
</appSettings>
</configuration>
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
when we use a NavigationService instance(nav) to navigate. then a NavigationWindow or Frame will add a journal automatically. sometime,we want to control this process. how to do it?
I just want to write a name to its stack. and dispose the privious page.
thanks.
|
|
|
|
|
Collin Jasnoch wrote: Like I would like to open a word doc with whatever application the user has installed and prefers for ".doc" files rather than forcing them to use a specific application that I assumed they have installed.
That part's easy - just pass the path of the file to Process.Start , and Windows will open it using the associated program.
Process.Start(@"C:\Path\To\Your\File.doc");
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
How would the DataTransferManager solve the issue of opening a document with the user-preferred application, rather than the current default application, if the user isn't going to configure that application in advance?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Yes, but that's the first part of your question, which I didn't attempt to answer.
I was answering the second part:
Collin Jasnoch wrote: I would like to open a word doc with whatever application the user has installed and prefers for ".doc" files rather than forcing them to use a specific application that I assumed they have installed.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I'm still struggling to see how any API could use the user's preferred application, rather than the system default application, if the user hasn't configured anything.
Based on your previous messages, the user wants to open a text file in Notepad++, but the file association is configured to use Notepad. Unless the user changes that configuration, how would an API know to open the file in anything other than Notepad? Short of prompting the user every time you open a file, I don't see how that could work.
No matter how good the APIs are, I don't think Microsoft has invented a mind-reading API yet.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|