 |
|

|
Hello richard,
Thank you very much for your response, Finally, I want to know. How to implement the error border as a wavy line? and how it is apply in Silver light, Not in WPF.
Regards
Salam
|
|
|
|

|
Silverlight and WPF are very much the same. Read the article I pointed you at and implement the validation rules.
|
|
|
|

|
Hello,
I'm creating a log in window with 2 text boxes.
One text box for user name and the second text box for password.
I want the text boxes to show default almost transparent text and when the user starts to type inside the text box the text will disappear.
For example in the password text box will be written "PASSWORD".
How can i do this in WPF text box.
Thanks
|
|
|
|
|

|
Dear Buddies,
Required your help / suggestion.
I have created a WPF windows application. Now for some reason i wanted to convert the same to web application.
Can any one please give suggestion on how to convert the same with minimal effort?
Converting the application to silverlight would be easier? if so i googled on the same i am getting reply that need to use prism and all to acheive the same.
Can you guys please suggest the way to convert my wpf application to web application with minimal effort.
Thanks in advance.
|
|
|
|

|
Correct, you have to go with silverlight only. Prism is one of the popular MVVM frame work. there no mandatory that you need to use all of these things, You can create your app with out them as well. But Building WPF/Silverlight is advisable.
|
|
|
|

|
Strictly speaking, PRISM is not an MVVM framework. Yes, it has some MVVM features, but it is better regarded as an application composition framework. If the OP didn't build his original app with PRISM then he's got a whole host of work in trying to convert it into PRISM.
|
|
|
|

|
Dear hari,
Thanks for your suggestion will try the same and get back.
|
|
|
|
|

|
Dear Abinav,
Thanks for your time in replying.
Yes we can go with xbap application even i too thought that also.
But my basic requirement of converting this wpf to an web application is that
1) I am connecting centralized sql server with ado.net which have image data type also, so when i connect to the centralized database and fetch the data and also image am getting huge delay on getting the same.
I even asked a question on C# discussion forum on the same and they suggested me to go with image storage in physical drive and use web browser control to access the image. And instead of ado.net can use webservices.
But my thought is that if we create an web application and host the application in same server where the data base server exists will solve my problem. Thats the reason i wanted to convert into web application.
2) According to my understanding xbap application is that, when we trigger that it will download the exe to the local desktop through browser and run from local machine. If that is the case once again i hope i will be getting the same issue. If its is not the case i hope xbap would be the right option for me.
Please correct my if my understanding is wrong.
Thanks in advance.
|
|
|
|

|
Hema Bairavan wrote: According to my understanding xbap application is that, when we trigger that it will download the exe to the local desktop through browser and run from local machine.
Silverlight will be no different. A Xap file will be downloaded on your client.
Infact, SIlverlight does not support ADO.Net directly. You will need to use WCF (or the entity framework) on the server to communicate with the database.
Isolated storage would be faster, but fairly limited - so its good for a limited number of images.
|
|
|
|

|
Dear Abinav,
Thanks for reply.
1) So you mean even though i move to silver light also my issue wont get solved?
2)if i go with WCF or entity with local servers wont it help me regarding handling data and image data types with centralized server?
3) And regarding XBAP, Will it download the xbap file exe to the local machine and it will work from local desktop like windows application like that it will connect db via internet only rt?
Sorry for asking couple of questions as i am in critial phase.
Thanks in advance
|
|
|
|

|
Hema Bairavan wrote: 1) So you mean even though i move to silver light also my issue wont get solved?
You will be able to access isolated storage if that was your main requirement.
Hema Bairavan wrote: 2)if i go with WCF or entity with local servers wont it help me regarding handling data and image data types with centralized server?
Sorry but I dont understand your conecrn here.
Hema Bairavan wrote:
3) And regarding XBAP, Will it download the xbap file exe to the local machine and it will work from local desktop like windows application like that it will connect db via internet only rt?
Yes, an xbap file will be downloaded to you machine.
|
|
|
|

|
Abhinav S wrote:
Hema Bairavan wrote: 2)if i go with WCF or entity with local
servers wont it help me regarding handling data and image data types with
centralized server?
Sorry but I dont understand your conecrn
here.
No, Actually my issue was to handle the image through centralized server. So i thought to host the web application and db server in the same machine. if i use ado.net it will work fine and also its working fine now. But if i go for wcf or entity model, will it also take more time to give me data having image data type?
Abhinav S wrote:
Hema Bairavan wrote:
3) And regarding XBAP, Will it
download the xbap file exe to the local machine and it will work from local
desktop like windows application like that it will connect db via internet only
rt?
Yes, an xbap file will be downloaded to you machine.
Ok thanks for your reply. So, xbap will behave like local windows application, if i use ado.net to connect centralized sql server to get data having image data type it will also take time like windows application???
i hope with this reply our conversation will come to end
Thanks as always.
|
|
|
|

|
By your requirement, changing the application to a webapplication (be it by web forms, silverlight or XBAP) will not solve your problem. In fact, you will only lose yet more performance.
If your application is loading images from a centralized server and that is making things slow, I think your problem is on the transfer rate of those images. If you can change your application to do a local cache of the images, you will only need to go to the server the first time (the first download) of that image, and later you can use it locally.
Surely it is good to use some mechanism to check if the image needs to be updated or not (considering the server image changes), but that's all.
Doing an web page, you will:
Have to send the application throgh tcp/ip + the images through tcp/ip. Even if the webserver does a local access, the client will use tcp/ip to get to the webserver.
The only advantage is that browsers deal with the cache for you (but considering you will need to rewrite the application, it is not a real advantage).
For the item 2. All web applications do almost the same. HTML applications can have code that executes on the server, but they will send such HTML to the client. That HTML can then asks for postbacks or call a web-service, but it executes locally (on the client).
WPF (as XBAP) and Silverlight are like the HTML code in the sense they execute on the client machine, but for anything else, they should call the webserver (a service call... WCF, for example). So, I am sure your problem is not there.
|
|
|
|

|
Thanks paulo for your time on replying.
Will check on this and update you once it is done.
thanks
|
|
|
|

|
It all depends how you created your WPF app, and what resources it uses; e.g. does it use the local file system, are you using custom printing, etc. Is it written using an MVVM framework, or is it written using code behind?
There is no magic bullet - we can't give you a hard and fast figure I'm afraid.
|
|
|
|

|
Dear Hanlon,
Thanks for your time in replying.
My WPF app is not using any local file system, am just allowing the user to select and save the image to the database.
And yes i have some printing functionalities directly to the printer but that i can manage with some other reports and give a print to the pritner they have.
I am not using MVVM frame work, i just using the code behind with three tier architecture to do the coding.
So with this how can i proceed further please suggest.
Thanks in advance.
|
|
|
|

|
No, You cannot "convert" to a web application. This would be a massive re-work.
Silverlight however would be a very good way to get your application to be viewed in the web as this is in effect an application plugin hosted in a browser. You do not need Prism or any other framework but I would strongly recommend using one as it stops you re-writing many boiler plate code or functionality that is already written and tested.
With WPF and Silverlight, you can create an application and then share the same code across your platforms. I would recommend downloading the Prism framework. In there the Stock_RI application has a couple of samples, one being cross platform development / Multi target.
Failing that, follow this helpful link below
http://msdn.microsoft.com/en-us/library/ff921109(v=pandp.40).aspx[^]
|
|
|
|

|
Hi all,
I'm working on a WPF solution where I have to populate a combobox depending on the selected item of another combobox. But I get an error.
The XAML code is:
<Window xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
x:Class="ICP.Reporting.WPFReportViewer.Windows.Report_Script_Resultaten"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:navigation="clr-namespace:Infragistics.Silverlight.SampleBrowser.Framework.Controls;assembly=Infragistics.Silverlight.SampleBrowser.Framework"
xmlns:ig="http://schemas.infragistics.com/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:uri="clr-namespace:ICP.Reporting.WPFReportViewer.Resources.ReportUri"
xmlns:res="clr-namespace:ICP.Reporting.WPFReportViewer.Resources.Pages"
d:DesignHeight="500" d:DesignWidth="567" SizeToContent="WidthAndHeight"
Title="Report Scripts Resultaten"
WindowStartupLocation="CenterScreen" Icon="/ICP.Reporting.WPFReportViewer;component/Images/Report_New.ico">
<Window.Resources>
<uri:ReportLibraryUri x:Key="ReportLibraryUri" />
<res:ParametersStrings x:Key="ParametersStrings" />
</Window.Resources>
<Grid x:Name="LayoutRoot" HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Name="stackPanelParameters" Orientation="Vertical" VerticalAlignment="Top" Height="Auto" HorizontalAlignment="Center" Width="170" Grid.Row="0" Grid.RowSpan="1" Grid.Column="0" Grid.ColumnSpan="1" Margin="10,5">
<GroupBox Name="groupBoxBeginEindDatum" Header="Kies begin- en einddatum" Height="Auto" Width="Auto" Margin="0,5,0,0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
<StackPanel Name="stackPanelBeginEindDatum" Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center" Height="Auto" Width="Auto" >
<!-- <Label Height="28" Content="{Binding Source={StaticResource ParametersStrings}, Path=Binding_StartDate}" Margin="15,10,5,10" Width="77"/> -->
<Label Height="20" Content="Begindatum:" Margin="15,5,15,0" Width="77" Padding="5,0" HorizontalAlignment="Center" HorizontalContentAlignment="Center" />
<!--<DatePicker Name="datePickerBeginDatum" Height="23" Width="120" SelectedDateFormat="Short" DisplayDate="{x:Static sys:DateTime.Now}" Text="" SelectedDate="{x:Static sys:DateTime.Now}" Margin="5,0" Padding="2" />-->
<DatePicker Name="datePickerBeginDatum" Height="23" Width="120" SelectedDateFormat="Short" DisplayDate="01-01-2012" Text="" SelectedDate="01-01-2012" Margin="5,0" Padding="2" />
<!-- <Label Height="28" Content="{Binding Source={StaticResource ParametersStrings}, Path=Binding_EndDate}" Margin="15,10,5,10" Width="70"/> -->
<Label Height="20" Content="Einddatum:" Margin="15,5,15,0" Width="77" Padding="5,0" HorizontalAlignment="Center" HorizontalContentAlignment="Center" />
<!--<DatePicker Name="datePickerEindDatum" Height="23" Width="120" SelectedDateFormat="Short" DisplayDate="{x:Static sys:DateTime.Now}" Text="" SelectedDate="{x:Static sys:DateTime.Now}" Margin="5,0" Padding="2" />-->
<DatePicker Name="datePickerEindDatum" Height="23" Width="120" SelectedDateFormat="Short" DisplayDate="12-31-2012" Text="" SelectedDate="12-31-2012" Margin="5,0" Padding="2" />
</StackPanel>
</GroupBox>
<GroupBox Name="groupBoxAuthoriteitScript" Header="En authoriteit en script" Height="Auto" Width="Auto" Margin="0,5,0,0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
<StackPanel Name="stackPanelAuthoriteitScript" Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center" Height="Auto" Width="Auto">
<Label Height="20" Content="Authoriteit:" Margin="15,5,15,0" Width="77" Padding="5,0" HorizontalAlignment="Center" HorizontalContentAlignment="Center" />
<ComboBox Height="25" Name="comboBoxAuthoriteit" Margin="5,0" Padding="2" SelectedIndex="-1" ItemsSource="{Binding}" DisplayMemberPath="Name" IsSynchronizedWithCurrentItem="True" SelectionChanged="comboBoxAuthoriteit_SelectionChanged" />
<Label Height="20" Content="Script:" Margin="15,5,15,0" Width="77" Padding="5,0" HorizontalAlignment="Center" HorizontalContentAlignment="Center" />
<ComboBox Height="25" Name="comboBoxScript" Margin="5,0" Padding="2" SelectedIndex="-1" ItemsSource="{Binding}" DisplayMemberPath="Name" />
</StackPanel>
</GroupBox>
<GroupBox Name="groupBoxRapport" Header="Rapport" Height="Auto" Width="Auto" Margin="0,5,0,0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
<StackPanel Name="stackPanelRapport" Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center" Height="Auto" Width="Auto">
<!-- <Button Content="{Binding Source={StaticResource ParametersStrings}, Path=Refresh}" Margin="20,5,10,5" Click="Button_Refresh_Click" Height="23" Width="61" /> -->
<Button Content="Genereer rapport" Margin="5" Click="Button_Refresh_Click" Height="23" Width="100" HorizontalAlignment="Center" VerticalAlignment="Center" />
</StackPanel>
</GroupBox>
</StackPanel>
<ig:XamReportViewer HorizontalAlignment="Center" Name="xamReportViewer1" VerticalAlignment="Bottom" PageFit="Width" UseLayoutRounding="True" MinWidth="380" MinHeight="445" PageMargin="0" AutoRender="True" Grid.Row="0" Grid.Column="1" Margin="0">
<ig:XamReportViewer.RenderSettings>
<ig:ClientRenderSettings DefinitionUri="/ICP.Reporting.ReportingClassLibrary;component/ReportDesigns/Report_Scripts_Resultaten.igr" />
</ig:XamReportViewer.RenderSettings>
<!-- Binding parameters -->
<ig:XamReportViewer.Parameters>
<ig:Parameter ParameterName="beginDatum" ParameterValue="{Binding ElementName=datePickerBeginDatum, Path=SelectedDate}"/>
<ig:Parameter ParameterName="eindDatum" ParameterValue="{Binding ElementName=datePickerEindDatum, Path=SelectedDate}"/>
<!--<ig:Parameter ParameterName="Maand" ParameterValue="{Binding ElementName=comboBoxMaand, Path=SelectedValue}"/>
<ig:Parameter ParameterName="Jaar" ParameterValue="{Binding ElementName=comboBoxJaar, Path=SelectedValue}"/>
<ig:Parameter ParameterName="Authoriteit" ParameterValue="{Binding ElementName=comboBoxAuthoriteit, Path=SelectedItem}"/>
<ig:Parameter ParameterName="Script" ParameterValue="{Binding ElementName=comboBoxScript, Path=SelectedItem}"/>-->
</ig:XamReportViewer.Parameters>
</ig:XamReportViewer>
</Grid>
</Window>
The code behind is:
using ICP.Reporting.ReportingClassLibrary;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Infragistics.Controls.Reports;
namespace ICP.Reporting.WPFReportViewer.Windows
{
When I run the solution I get the sqlexception "The multi-part identifier "System.Data.DataRowView" could not be bound."
on the following line:
daScript.Fill(dsScript, "Questionnaires");
Can someone tell me where I'm going wrong and what I have to correct?
Thank you very much for your help.
Greetings,
Geert De Vylder
|
|
|
|

|
Without ratting through your code I would guess that you are passing in the row object into the query and it is turning the object into a string(). You should be passing in the SelectedValue from the combo not the SelectedItem.
Never underestimate the power of human stupidity
RAH
|
|
|
|

|
Hi Mycroft,
I have tried this also, but that doesn't work neither.
Greetings,
Geert
|
|
|
|

|
I have a RichTextBox with attached property:
<RichTextBox x:Name="rtf" wpfPages:ScrollBarUtils.VerticalScrollValue="{Binding ElementName=scroll, Path=Value}"/>
which binds to ScrollBar.Value property.
I want to bind back ScrollBar.Value to this attached property. Smth like this:
<ScrollBar x:Name="scroll" Value="{Binding ElementName=rtf, Path=(wpfPages:ScrollBarUtils.VerticalScrollValue)}"/>
Please advice how can I do it?
savbace
|
|
|
|

|
Good Day i have a Window in WPF defined like this
<Window x:Class="RVI_Education.Gavigator"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Gavigator" Height="673.2" Width="1304.4">
<Frame Name="FrameWithinGrid" >
</Frame>
</Window>
and im using it as a start up in my app.xaml
<Application x:Class="RVI_Education.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="Gavigator.xaml">
<Application.Resources>
</Application.Resources>
</Application>
and on Window loaded event i navigate to another Window
like this
public Gavigator()
{
InitializeComponent();
Loaded += Gavigator_Loaded;
}
void Gavigator_Loaded(object sender, RoutedEventArgs e)
{
FrameWithinGrid.Navigate(new System.Uri("Splash.xaml",UriKind.RelativeOrAbsolute));
}
when i load the Project i get an Error
'RVI_Education.Splash' root element is not valid for navigation.
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[at]dotnetfunda.com
http://www.Dotnetfunda.com
|
|
|
|

|
The error message indicates that the error is in Splash.xaml, which you haven't posted. I would guess that Splash.xaml is a Window, which won't work:
http://stackoverflow.com/a/7078211/124386[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|

|
There is nothing wrong with the Splash Window , the problem is that im trying to navigate from a Window to a Window.
thank for the link , i will continue with the nasty creation of object and disposing them.
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[at]dotnetfunda.com
http://www.Dotnetfunda.com
|
|
|
|

|
Hi guys, can u share with me about random image with array in WP ?
|
|
|
|

|
Eh? What exactly do you mean?
|
|
|
|

|
If you are using bytes to store a byte array, this[^] would give you an idea on what you need to do to display a random image.
Note that all API's may not be available in WP so you may have to improvise to achieve similar results.
|
|
|
|

|
Thank you, but i want to random image not byte..
|
|
|
|

|
You'll have to define what you mean by "random image" because I would have suggested the exact same thing. Store a bunch of random bytes in an array and treat that as image data.
|
|
|
|

|
Hi,
I am working on a WPF application. The application uses Infragistics controls such as Ribbon Controls and XamDockManager. It has a File Menu wherein I have provided a Save menu item to save the items on the canvas to a file. On click of Save button, Save Dialog opens to provide the File name and file is saved at the defined location.
The saving process is quite time consuming and in order to show something to the user, I have used the WaitCursor.
I have used a class similar to the one mentioned(UiServices.ShowWaitCursor) in the below thread.
http://stackoverflow.com/questions/7346663/how-to-show-a-waitcursor-when-the-wpf-application-is-busy-databinding[^]
http://stackoverflow.com/questions/3480966/display-hourglass-when-application-is-busy[^]
The usage is like this
public void WriteToFile(string fileName)
{
UiServices.SetBusyState();
_customFileWriter.WriteToFile(fileName);
}
This works fine, if we just save the things on the canvas into a file. However, if fails in the below scenario.
The application has a canvas where I display some UI elements. On double click of the UI element, we launch a Windows form in the Infragistic ContentPane.
We have a modeless dialog opened and perform File -> Save and provide a file name, the cursor stays indefinitely. It goes only once we click on the Canvas. The DispatcherTimer_Tick is fired only when we click on the Canvas which resets the cursor.
The DispatcherPriority is ApplicationIdle.
Another observation is, this happens only when we open the Save dialog through the File -> Save. It works fine if we open the Save dialog through Ctrl + S key combinations.
Is there a way I can debug the non firing of DispatcherTimer.Tick event or any other way to handle this?
I created a simple WPF application and it works fine in that.
MainWindow.xaml
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Menu Height="36" Name="menu1" Margin="12,0,439,197">
<MenuItem Header="_File" Height="22" Name="menuitem1" Width="200" Margin="10, 10, 5, 5" HorizontalAlignment="Left" VerticalAlignment="Top" Background="Chocolate">
<MenuItem Header="Save..." Click="MenuItem_Click"/>
</MenuItem>
</Menu>
<Canvas Height="156" HorizontalAlignment="Left" Margin="81,77,0,0" Name="canvas1" VerticalAlignment="Top" Width="304" Background="#FF945050">
<Button Canvas.Left="128" Canvas.Top="49" Content="Button" Height="23" Name="button1" Width="75" Click="button1_Click" />
<TextBox Canvas.Left="48" Canvas.Top="128" Height="23" Name="textBox1" Width="120" />
</Canvas>
</Grid>
</Window>
MainWindow.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
namespace WpfApplication1
{
Thanks in advance!
|
|
|
|

|
I can't execute your code (I don't have those libraries you use), but can you use another priority?
I don't know... maybe you have an animation or similar that is never really letting the application become idle.
Note: Seeing your code, you don't need to use a DispatcherTimer. It is enough to do a Dispatcher.BeginInvoke to call your delegate. This will also guarantee that it will execute only once, as soon as all the messages (including the actual one) are processed. In fact, I think your problem is that you never started your timer.
|
|
|
|

|
Hi
Hopefully this will be a quick question to answer, but personally I'm not sure which way to go.
Firstly I'm using SL5, MVVM, MEF, EF. I have a person entity - the person entity has a collection of account entities, address entities and order entities.
In my view I am displaying a list of the people on the left with the corresponding lists on the right (accounts, addresses, orders). When the person is changed in the list I obviously want the lists on the right to update.
Obviously it would be inefficient to just include the lists in the domain service query using the .Include() operation as it will return ALL the people with ALL the related list entities. This is where my dilemma is - when I change the person do I either:
Load each of these lists separately, each with their own completed events where I populate the view lists. Which is basically three extra calls to the DB.
OR
2. Call a different GetPeople query in the domain service where I pass in the current person ID and use the .Include() operation to include accounts, address and orders, but filter by the passed in PersonID. (i.e. return this.ObjectContext.People.Include("Accounts").Include("Addresses").Include("Orders").Where(p=>p.ID == PersonID);)
Any help is much appreciated.
Thanks.
|
|
|
|

|
Can I integrate WPF application in web application??
Detail:-
I am working in a website, in this I want to integrate a small WPF application. Can i do this?? for eg... I wanna open login/signin popUp ("which is created in WPF") in my web application to enter the user in main page.
or we can say that in any tutorial webpage, I want to insert demo application of WPF application.
If it is possible please let me know, how i can do this.
Thanks in advance.
|
|
|
|
|

|
If you are going to develop an application from scratch, you may also want to consider using Silverlight - this will give you scope to development for the web.
Note that any SL application can be run outside the browser too.
|
|
|
|

|
I'm working on an WPF MVVM application. The data entry screen has to have all it's fields disabled until the user clicks "Add" or "Edit", and also the fields cannot become enabled if the user does not have rights to that field.
So, I would like to bind all IsEnabled properties in the XAML to a single method on the ViewModel. I would need to pass in a string value which is the 'key' of the field. Then in the VM would use the key to check the rights. The method would be something like
public bool CanEnableField(string Key)
{
}
A converter would probably not work because that class won't know about the VM and the form's mode (Add/Edit).
I could bind each field's IsEnabled to individual properties on the VM and handle all this in the getter, but that would be a lot of properties in the VM.
Anyone have any thoughts on how to do this?
If it's not broken, fix it until it is
|
|
|
|

|
The best way is to have a bool Property in your VM, to which you caan bind the IsEnabled property of the relevant controls like this:-
VM:
public bool CanEnableField(string Key)
{
}
public bool EnableControls
{
get
{
return enableControls;
}
set
{
if (enableControls != value)
{
enableControls = value;
OnPropertyChanged("EnableControls");
}
}
}
View:
<Label Grid.Row="2" Content="Name : " HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="2,2,2,7" />
<TextBox Grid.Column="1" Grid.Row="2" Margin="2" IsEnabled="{Binding Path=EnableControls}" Text="{Binding Path=SelectedCustomer.Name, ValidatesOnDataErrors=True,UpdateSourceTrigger=PropertyChanged}" />
Hope this helps
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|

|
If you're using .NET 4.0 or 4.5, you can combine a single property with a dynamic object to achieve this:
public interface ICanEnableField
{
bool CanEnableField(string key);
}
public sealed class CanEnableFieldHelper : DynamicObject
{
private readonly ICanEnableField _owner;
public CanEnableFieldHelper(ICanEnableField owner)
{
_owner = owner;
}
public override bool TryGetMember(GetMemberBinder binder, out object result)
{
result = _owner.CanEnableField(binder.Name);
return true;
}
}
public class YourViewModel : ICanEnableField
{
private readonly CanEnableFieldHelper _helper;
public YourViewModel()
{
_helper = new CanEnableFieldHelper(this);
}
public dynamic CanEnable
{
get { return _helper; }
}
public bool CanEnableField(string key)
{
...
}
}
In you XAML, you can then bind to CanEnable.Key, which will return the result of calling CanEnableField("Key"):
<TextBox IsEnabled="{Binding Path=CanEnable.Field1}" ... />
When you need to change the state, you just need to raise the PropertyChanged event for the CanEnable property.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|

|
Thanks, I'll take a look at it
If it's not broken, fix it until it is
|
|
|
|

|
This worked perfect. Thanks!
If it's not broken, fix it until it is
|
|
|
|

|
I have a combo box bound to an ObservableCollection. The entity passed into the view has an instance of a ClassModel. I want to select the item in the combo which matches the entite's ClassModel.
So far im lookping over the ObservableCollection to find the item:
foreach (var jobClass in Classes)
{
if (jobClass.Id == JobRevision.JobClass.Id)
{
SelectedClass = jobClass;
break;
}
}
is there a way to do this without loopping?
Thanks
If it's not broken, fix it until it is
modified 12 Jan '13 - 21:27.
|
|
|
|

|
Can't you bind the SelectedValuePath of the combo to the SelectedJobClass.ID
Never underestimate the power of human stupidity
RAH
|
|
|
|

|
Not sure I understand. Can you post an example?
If it's not broken, fix it until it is
|
|
|
|

|
It is just the standard combo binding or am I missing something?
<ComboBox x:Name="cboType" Grid.Row="2" Grid.Column="1" ItemsSource="{Binding AttrTypeList,Mode=TwoWay}"
DisplayMemberPath="AttrType"
SelectedValuePath="AttrTypeID"
SelectedValue="{Binding SelectedAttrCostume.AttrTypeID,Mode=TwoWay}"/>
Never underestimate the power of human stupidity
RAH
|
|
|
|

|
Yes, but what are 'AttrType' and 'AttrTypeID' and 'SelectedAttrCostume'? Are they properties on the entities in the AttrTypeList list?
If it's not broken, fix it until it is
|
|
|
|
|

|
Ok, I don't know what's wrong, but I still cannot get this to work...
My combo is bound to an ObservableCollection, as in:
private ObservableCollection<LookupModel> _Departments;
public ObservableCollection<LookupModel> Departments
{
get { return _Departments; }
set
{
if (_Departments != value)
{
_Departments = value;
RaisePropertyChanged("Departments");
}
}
}
private LookupModel _SelectedDepartment;
public LookupModel SelectedDepartment
{
get { return _SelectedDepartment; }
set
{
if (_SelectedDepartment != value)
{
_SelectedDepartment = value;
RaisePropertyChanged("SelectedDepartment");
}
}
}
Here is the lookup model:
public class LookupModel : _BaseModel
{
private int _Id = 0;
public int Id
{
get { return _Id; }
set
{
if (_Id != value)
{
_Id = value;
RaisePropertyChanged("Id");
}
}
}
private string _Caption = string.Empty;
public string Caption
{
get { return _Caption; }
set
{
if (_Caption != value)
{
_Caption = value;
RaisePropertyChanged("Caption");
}
}
}
}
And in the vie model I have:
SelectedDepartment = Job.Department;
Job.Department is an instance of a lookup model with the selected department in it.
When I run this, the department is not selected in the combo.
What am I doing wrong here???
Thanks
If it's not broken, fix it until it is
|
|
|
|
 |