|
Yes.
BitMap effect.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
|
Look into WPF DataTemplates. You can use a TemplateSelector to select different templates based on some code in the TemplateSelector or you can use a DataTrigger in the DataTemplate to change which icon is displayed.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Thanks Karl. It worked for me. One more question, can we have separate icon for each node? I am asking because currently I am assigning image depending upon the HasItem property of treenode. In future I will like to show different icons for each node. Is it possible?
Jayant D. Kulkarni
Brainbench Certified Software Engineer in C#1.1, C# 2.0, ASP.NET, .NET Framework and ADO.NET
|
|
|
|
|
Yep.
Use one of the two previous methods I gave you and test against the data that is bound to the TreeV Item. Then display the icon you want.
WPF makes things like this very simple for developers. Got to love WPF.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Thanks Karl for reply. Yes it can be done using different properties, for example check the tag value and set the image. Now I am crating a generic user control and I want these images should dynamically get assigned. So, application1 will like some another icon at root level and different icon at child node level, similarly application2 will like to use some different icons. What I will like to do is let the application using my control set the images programmatically. How can we do this?
Jayant D. Kulkarni
Brainbench Certified Software Engineer in C#1.1, C# 2.0, ASP.NET, .NET Framework and ADO.NET
|
|
|
|
|
This a SUPER easy in WPF.
Read up on Styles and ControlTemplates . There are a lot of WPF articles here on Code Project that cover this topic.
This is one of the foundational powers that WPF delivers.
You can simply write one Style, place it in application scope and all Tree controls can use it.
The possibilities are endless.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
I`m trying to play a short sound using MediaPlayer class. I`m using the following code snippet:
MediaPlayer mp = new MediaPlayer();
mp.Open(new Uri(@"C:\...\Dom.wav"));
mp.Volume = 1D;
mp.Play();
It goes well, but when I try to play this sound in my form (where I have several endless transformations), it never gets played. I suppose that the reason is that it is to be played on the same thread that UI works. And as the UI works all the time (because of endless transformations), my .wav never gets enough CPU to be played. So I tried to launch it on separate thread. It didn`t help either. The only solution I found is to add a sleep after this:
MediaPlayer mp = new MediaPlayer();
mp.Open(new Uri(@"C:\...\Dom.wav"));
mp.Volume = 1D;
mp.Play();
Thread.Sleep(1500);
But this looks terrible. Could anyone give me another solution?
|
|
|
|
|
If you just want to play sound, look into the managed DirectX classes instead.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Don`t tell me it can`t be done using MediaPlayer class...
|
|
|
|
|
I don't know, but I know that class is slow, and it seems to me like overkill
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Using so enormous technology as DirectX to play 5-second simple sound is even bigger overkill. Thanks for advice however.
|
|
|
|
|
Not really - it's just using built in stuff that is there already.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hello,
i want to make an application by uing xaml, but i dunno what should i need to install, i searched but didnt found what exactly i should have.
at this time, i've
1. Visual Studio 2005
2. .Net Framework 2.0
please tell what i require
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
You need to install .NET 3.0, which will give you what you need to build a WPF app. There are also add ins for some IDE support.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
ok and what about .net 3.5 ? isnt it better?
thanks
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Yes, it is. But, that's what comes with VS2008. I'm not sure if there's a WPF VS2008 Express Edition, otherwise, you'd need to buy it.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
you mean that if i installed 3.5 on VS 2005 then it wont work ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Of course not. If it did, who would upgrade to VS2008 ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
yeah thats true
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
I installed .net framework 3.0, but there is no XAML
thanks
EDITED
oh i found, i installed Visual Studio 2005 extensions for .NET Framework 3.0 (WCF & WPF), November 2006 CTP
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
modified on Saturday, February 23, 2008 10:53 PM
|
|
|
|
|
|
I just posted an article on this.
http://www.codeproject.com/KB/WPF/WPFBusinessAppsPartTwo.aspx[^]
Download the code and look at the resource dictionaries in the Skins folder.
Basically you need to set up a control template. I have placed the following markup at application scope.
The markup will render a * to the left of the TextBox is there is a validation error.
<ControlTemplate x:Key="validationTemplate">
<DockPanel>
<TextBlock Margin="5,0,5,0" Foreground="Red" FontSize="16"
VerticalAlignment="Center" Text="*" />
<AdornedElementPlaceholder />
</DockPanel>
</ControlTemplate>
<Style TargetType="{x:Type TextBox}">
<Setter Property="Validation.ErrorTemplate" Value="{DynamicResource validationTemplate}" />
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="true">
<Setter Property="ToolTip" Value="{Binding Path=(Validation.Errors)[0].ErrorContent,
RelativeSource={x:Static RelativeSource.Self}}" />
</Trigger>
</Style.Triggers>
</Style>
This should get you going. Please read the article, it will really help in this situation.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
|
What I showed you is still valid (almost).
IN WPF 3.0 you still have a Validation.ErrorTemplate. The template I showed will do what you need. The validation error occurs when the object you are binding to throws an exception. Just modify your business object to throw an exception.
The below link shows how to do validation in 3.0 and 3.5. Very easy to do.
http://blogs.msdn.com/wpfsdk/archive/2007/10/02/data-validation-in-3-5.aspx[^]
modified 27-Feb-21 21:01pm.
|
|
|
|