|
I've already been there and it was no help.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: global to the application
If I have a style or template that I want to be global I use a MergedDictionary, for example.
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Dictionaries\Styles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
John Simmons / outlaw programmer wrote: how do I get to it once it's there
You would access the style/template using the key you define for it.
Resource dictionary:
<ControlTemplate x:Key="NormalButtonTemplate" TargetType="{x:Type Button}">
snip...
</ControlTemplate>
Then in your xaml you would assign it using the key in this case:
<Button Template="{DynamicResource NormalButtonTemplate}" />
Hope that helps
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
|
|
|
|
|
It is possible to put your Style in the App.xaml with the <application.resources> and that will put your style at the application level and in order to access it you can Style="{StaticResource (Name Here)}" and that will get your Style from the application resources.
|
|
|
|
|
You could also put these in a separate Style dll altogether ...
|
|
|
|
|
Consider the following code:
<Canvas Panel.ZIndex="999" HorizontalAlignment="Left" Width="225" Height="262" VerticalAlignment="Top">
<Expander Margin="-13,-47,0,-210" Name="expander1" Background="Transparent" HorizontalAlignment="Left"
Width="221" Height="257" Canvas.Top="48" Canvas.Left="14">
<Expander.Header>
<Rectangle Height="26" Margin="22,-21,0,0" Name="rectangle1"
Stroke="OrangeRed" VerticalAlignment="Top" RadiusX="8" RadiusY="8" Fill="DarkBlue" />
<Label Margin="22,-20,0,0" Background="Transparent" Foreground="White" Name="label99"
FontFamily="Arial" FontSize="14" FontWeight="Bold" FontStyle="Italic"
HorizontalContentAlignment="Center"
Content="BTN:123-456-7890" Height="26" VerticalAlignment="Top" />
</Expander.Header>
<Grid >
<Grid.BitmapEffect>
<DropShadowBitmapEffect />
</Grid.BitmapEffect>
<telerik:RadTreeView blah blah blah />
</Grid>
</Expander>
</Canvas>
The designer is giving the following error:
The property "Header" is set more than once.
I don't understand why I'm getting this error - there's only one header specification in the control.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I'm not an expert at all but in this case you just can't use several controls inside the header.
Instead you can use a Grid or Stackpanel or similar and there put your Rectangle and Label.
|
|
|
|
|
It is because you are trying to add two elements the Rectangle and Label. You can put both inside a grid or other kind of panel or maybe you could put the label inside a border and not need the Rectangle.
|
|
|
|
|
Expander.Header is an object not a collection. You can't put both a rectangle and a label in it. Put only one object.
Eslam Afifi
|
|
|
|
|
I have one MFC control,which one i create, and I convert this as a .dll file and add a System::Windows::Forms::UserControl to this dll and whit the help of this Usercontrol I can load this control in WinForm application.
I need to use this control in WPF application, with out using the System::Windows::Forms, So, i think, I need to add a System::Window::Controls::UserControl to the dll and convert this as a UIElement^. But I have no idea how to do this. If you have some idea, or any help pages in internet, how to create a System::Window::Controls::UserControl from a MFC dll please help me.
|
|
|
|
|
|
I have a datagrid with a DataGridTemplateColumn. The DataTemplate is a Image wrapped by a Button.
<wpftoolkit:DataGridTemplateColumn Header="Search Type" IsReadOnly="True" >
<wpftoolkit:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button x:Name="btn" Width="25" Height="25" >
<Image x:Name="icoDisplay" Source="../Resources/plus.png"></Image>
</Button>
</DataTemplate>
</wpftoolkit:DataGridTemplateColumn.CellTemplate>
</wpftoolkit:DataGridTemplateColumn>
I'm trying to change the image source when a row is selected. I want to show an image with a "+" when the details for a row are not showing. I want to show an image with a "-" when the details for a row are showing. I want to change the image source when the row is selected in any cell of the row, not just when the button/image are selected. I don't have to have the button there if it can be done without it.
Any help with this would be greatly appreciated.
|
|
|
|
|
Hi,
I have a WPF DataGrid (from WPFToolkit) which dispays the results of several queries from a database.
I am returning the results to a datatable and then setting the DataContext of the DataGrid to = the DataTable, so no Binding.
I need to programatically format the "StringFormat" of each column at runtime ie. for Date - "dd MM yyyy" etc.
This is very easy to do with a normal windows forms DataGridView but looks to be nearly impossible to do with the WPF Datagrid.
I cannot create the columns in XAML as I do not know what they will be, every query is different and can change what it returns.
I have spent 2 days trying to resolve this issue, and have not found a single post which actually solves this problem.
Any help would be much appreciated.
Thanks
|
|
|
|
|
Just Use AutoGeneratedColumns Event of the DataGrid:-
In the below mentioned example DataGrid Name is "dgvTimming"
void dgvTimming_AutoGeneratedColumns(object sender, EventArgs e)
{
foreach (DataGridColumn item in dgvTimming.Columns)
{
switch (item.Header.ToString())
{
case "Plan_Timing":
item.Header = "Plan Timing";
break;
case "Pacesetter":
case "Contingent":
if (item.GetType().ToString() == "Microsoft.Windows.Controls.DataGridTextColumn")
{
DataGridTextColumn dg = (DataGridTextColumn)item;
dg.Binding.StringFormat = "C";
}
if (item.Header.ToString() == "Contingent")
item.IsReadOnly = true;
break;
}
}
}
Yogesh Sharma
|
|
|
|
|
hi
i work somewhere as a programmer
i know somethings in c#
and you know i want to use the WPF
and want to know where should i start it
please tell me which book,tutorial or other material is the best start line for an absolute beginner in WPF
thank you all that kindly help me to be improved and so be happy
just improvement cause real happiness
thank you everybody
|
|
|
|
|
here the book name
Sams - Teach Yourself WPF in 24 Hours
You have To Search About The Truth Of Your Life
Why Are you Here In Life ?
|
|
|
|
|
|
How do I go about adding a 'Command' property to a custom WPF control derived from an existing control? I want to use the Command property the same way you would use a Command property on a button--to bind to any ICommand or routed command.
I rely heavily on MVVM, and my UI controls are almost always bound to ICommand objects in my view model. I have started using the Actipro Wizard control for my WPF wizards, and it's very good. But it's missing one thing: It won't let you bind a command to the activation of a wizard page.
In many wizards, a process should start automatically when a wizard page is activated. For example, in a file copy wizard, pages 1 and 2 get file paths from the user, and when the user advances to page 3, the copy should begin automatically, displaying a progress bar for the operation.
Unfortunately, the Actipro WizardPage doesn't have a Command property that fires a command when the page is activated. It does have a 'Selected' event, which I'm using now. But I would rather bind to a command in XAML, so I am extending the ActiPro WizardPage control to add a 'Command' property that will fire when the page is activated.
Can anyone point me to any articles or blogs on how to implement a 'Command' property and give the derived control the CanExecute() behavior expected of a command-bound control? Thanks.
David Veeneman
Foresight Systems
|
|
|
|
|
Found my answer. A derived control that wants to implement a Command property must implement the ICommandSource interface. There is an MSDN article[^] that shows how to do it, as well as a code sample[^].
David Veeneman
Foresight Systems
|
|
|
|
|
Hi,
I have a WPF textbox and I want to validate the text the user types i.e. only numbers are allowed. To do this I have set
<pre>Text="{Binding MobileNumber, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}</pre>
And the property is
<pre> public string MobileNumber {
get {
return mobileNumber;
}
set
{
if (AllowedPhoneNumberCharacter(value))
mobileNumber = value;
OnPropertyChanged("MobileNumber");
}
}</pre>
If the user types a character we came to <i>set </i> and after OnPropertyChanged("MobileNumber"); a call to <i>get </i>is made. But the textbox is not updated, why?
Example:
09876 :User types o phone number. OK
098767 :User adda a digit 7. OK
098767g :Not OK to add g. Now I want to update textbox with 098767.
Regards
Marc
|
|
|
|
|
I believe the PropertyChanged is not fired until the user leaves the textbox. I believe you have to process the KeyDown events to get that kind of control. You can check to see if the key is an alpha character. If the key is an alpha then set the e.Handled property to true and the keystroke won't go the text area.
My 2 cents,
Richard
|
|
|
|
|
Dear friends
any body help me to host silverlight project from local host(Step by Step Processors).
I have got lots of link but that are not help full . that very confusing in virtual directory and MIME Type. that link are not sufficient to understand of deployment of Silver Light Project please help me
Piyush Vardhan Singh
p_vardhan14@rediffmail.com
http://holyschoolofvaranasi.blogspot.com
http://holytravelsofvaranasi.blogspot.com
|
|
|
|
|
This question is really outside the scope of Silverlight.
Silverlight runs via a plugin hosted on a web page in a browser.
You need to know how to publish that web page.
That means you need an HTTP (web) server, like IIS, Apache, etc.
You should really ask on the web development board.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Then how we access silverlight application from different system or Computer?
Piyush Vardhan Singh
p_vardhan14@rediffmail.com
http://holyschoolofvaranasi.blogspot.com
http://holytravelsofvaranasi.blogspot.com
|
|
|
|
|
Piyush Vardhan Singh wrote: how we access silverlight application from different system or Computer?
The same way you access any web site.
Really, what you need to know is how to publish a website - it
will make sense when you know that.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
My Dear Friend
Thanks for continue reply....
supposed that my silver light application Url :-
URL:-http://localhost:2328/FileConversionTestPage.aspx
its work perfectly on my machine.it did not access through IP from different Machine and my machine.
URL:-http://192.168.12.5:2328/FileConversionTestPage.aspx
I also Create virtual Directory it also work Url:-
http://localhost/FileConversion/FileConversion.Web/FileConversionTestPage.html
http://192.168.12.5/FileConversion/FileConversion.Web/FileConversionTestPage.html
from my computer main page is open but when web services connection is going to connect then its give the Error:-
System.reflection.targetInvocationException:....... remote server returned an error:Not Found
it also did not access from different machine URL;-
http://192.168.12.5/FileConversion/FileConversion.Web/FileConversionTestPage.html
So I Want access my this Url:-
http://localhost:2328/FileConversionTestPage.aspx
From different machine. Please Help me to resolve my problem.
Thanks
Piyush Vardhan Singh
p_vardhan14@rediffmail.com
http://holyschoolofvaranasi.blogspot.com
http://holytravelsofvaranasi.blogspot.com
|
|
|
|