|
Christoph
Not sure what you are trying to do with the VisualTree as part of the FlipToBackEvent, but I would have thought you don't need to do that, and just raise the FlipToBackEvent event when you need to and them XAML Trigger will see that, and act accordingly.
This would seem right to me, but I just don't have the time right now to look further, sorry.
Sacha Barber
- Microsoft Visual C# MVP 2008
- Codeproject MVP 2008
Your best friend is you.
I'm my best friend too. We share the same views, and hardly ever argue
My Blog : sachabarber.net
|
|
|
|
|
Sacha
Just fire was my first attempt, and works for Triggers that are not inside a DataTemplate,
so I tried different things.. they all don't work
Thanks anyway
|
|
|
|
|
Ah ok, sorry to hear that. It sounded like that would work.
Sorry I don't have more time to look at this myself.
Sacha Barber
- Microsoft Visual C# MVP 2008
- Codeproject MVP 2008
Your best friend is you.
I'm my best friend too. We share the same views, and hardly ever argue
My Blog : sachabarber.net
|
|
|
|
|
Sacha -
found it finally (I rarely give up)
this one was hard for me, then I came to this
// http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/4a04938b-690b-4bd0-969a-6dc4f6d6fda5/
this.displayContent = ContentControl
foreach (Border _border in FindInVisualTree(this.displayContent, a => { return a is Border; }))
{
_border.RaiseEvent(new RoutedEventArgs(FlipToLoginEvent));
}
- Christoph
|
|
|
|
|
Cool, glad you are now sorted.
I would have maybe gone for the x:Key idea on that thread.
Sacha Barber
- Microsoft Visual C# MVP 2008
- Codeproject MVP 2008
Your best friend is you.
I'm my best friend too. We share the same views, and hardly ever argue
My Blog : sachabarber.net
|
|
|
|
|
you are right, not perfect though working
here I present my final solution (for the ones that search the internet desperately
private T GetObjectOfTypeInVisualTree<T>(DependencyObject dpob) where T : DependencyObject
{
int count = VisualTreeHelper.GetChildrenCount(dpob);
for (int i = 0; i < count; i++)
{
DependencyObject child = VisualTreeHelper.GetChild(dpob, i);
T childAsT = child as T;
if (childAsT != null)
{
return childAsT;
}
childAsT = GetObjectOfTypeInVisualTree<T>(child);
if (childAsT != null)
{
return childAsT;
}
}
return null;
}
private void ManualStartAnimation(string templateName, string elementName, RoutedEventArgs eventArgs)
{
DataTemplate _dt = (DataTemplate)this.FindResource(templateName);
if (_dt != null)
{
ContentPresenter _cp = GetObjectOfTypeInVisualTree<ContentPresenter>(this.displayContent);
if (_cp != null)
{
UIElement _element = (UIElement)_dt.FindName(elementName, _cp);
if (_element != null)
{
_element.RaiseEvent(eventArgs);
}
}
}
}
public void ShowLogin()
{
->kick ManualStartAnimation("flipItemTemplate", "frontHost", new RoutedEventArgs(FlipToLoginEvent));
}
|
|
|
|
|
THANK YOU! I so did desperately search the internet and I found your nice solution. Thanks again!
modified on Friday, January 9, 2009 3:19 PM
|
|
|
|
|
Hi!
Can anybody confirm there is a memoryleak by using Brushes this way?
private SolidColorBrush[] colors = new SolidColorBrush[] { Brushes.Green, Brushes.Red, Brushes.Yellow };
private void DoEverySecond(bool status)
{
this.Background = status == true ? colors[0] : colors[1];
}
If so, how can it be avoided?
Explanation:
I have a timer which checks the status every second. Therefore I use the dispatcher to invoke my control.
If I do it this way my application grows up to 2.7 GB RAM usage within 12 hours.
I think I located the problem to the Brushes, although I'm not certain. If this is the reason, could anyone be so kind to give me an example to avoid this?
Thanks in advance,
eza
|
|
|
|
|
Why are you doing this? I can see why you want to check something every second, but wouldn't you be better using data binding and a trigger to perform this? You want to change the background colour when the status changes - which is a perfect candidate for a datatrigger.
|
|
|
|
|
OK... thanks for the hint.
Could you provide me an example maybe, would help me a lot.
Thanks!
|
|
|
|
|
This[^] article might help you.
|
|
|
|
|
Hi all,
i got a trouble ,for my poor knowledge i don't know how begin my example(for my next first one project) i wish insert in my project a field "Image" to use it in a Carousel or else but i will develop my example with SqlServer ,Linq to Sql in WPf so if i create the field of Image into the database i'm afraid that the database will be heavy and slow and i have not idea how work out the best way with Linq and Wpf.
I ask help to advice me and show me the right way for my trouble...can you illuminate me?
Thanks so much for your attention.
I wish you happy day
Regards,
Bye
|
|
|
|
|
Just how big do you expect your images to be? Basically you have two choices - store your image in a database or store your image in the filesystem. If you're using SQL Server 2008, you can use a FILESTREAM datatype where the image data is stored on the filesystem but SQL Server is in control.
|
|
|
|
|
Dear Pete,
first thanks so much to reply me,
in my case i will develop a software in multithreading ,about 7 person will use it in in the same time and i got SQLServer 2005 if i put the image in a folder of the WPF's project in the field datatype of SqlServer what kind of datatype i must choose?
Pete i'm afraid to make the database heavy and slow (i have not experience about that) if you have some link to show me i will be grateful.
Thanks again for the support.
I wish you happy day
Regards,
Bye
|
|
|
|
|
I have Created a DeepZoom Project and it outputed a Project. Now when i view my Project in VS2008 i get the Following Error
Unable to read the Project File 'DeepZoomProject.csproj'. C:\Private Development\Vuyiswa's WebSite\Deep_Zoom\Vuyiswa_Maseko\Source Images\OutputSdi\vuyiswa\DeepZoomProject\DeepZoomProject.csproj(80,11):The Imported project "C:\Program Files\MSBuild\Microsoft\Silverlight\V2.0\Microsoft.Silverlight.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on the disk
and this is how my Project File looks on the Import line
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight\v2.0\Microsoft.Silverlight.CSharp.targets" />
I saw that , i dont have Silverlight Dirctory, the Structure of the directory is a bit Different. The Directory is like
C:\Program Files\MSBuild\Microsoft\Microsoft Silverlight\2.0.31005.0
Please Help
Thank you
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Oops Sorry i got the Solution
i have Searched for the File(Microsoft.Silverlight.CSharp.targets) in Computer and change the Import to point to the Derectory that i have Found the File and reload the Project and its Fine.
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Hi there,
I've just created a WPF application like a simple Player, then I create the relative dll file.
I've also created a Win32 Application and I added my dll file created earlier.
The question is:
How can I do for to call/run that dll file in my Win32 Application?
I hope to be clear,
Thanks a lot,
Carmelo.
modified on Tuesday, December 2, 2008 10:57 AM
|
|
|
|
|
I need to build a custom Carousel in Silverlight and C#
If somebody has done any research on it then please suggest me references that would help me a lot.
Thanks
|
|
|
|
|
Perhaps this[^] recent article may help.
Regards,
Syed Mehroz Alam
My Blog
My Articles
Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination. - Albert Einstein
|
|
|
|
|
Saw that article. It is a very good one.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
I was looking for a carousel component and found it at http://www.zenexis.com. They have many different types of components for Silverlight and WPF. The carousel is here:
http://www.zenexis.com/products/control/tabid/67/p-10-carousel.aspx
Hope this helps you.
|
|
|
|
|
Hi all,
I'm quite new to WPF and have a small problem with the template for the ComboBox control. I'm trying to change the ComboBox's border color, when the text box has the keyboard focus. Unfortunately, VS tells me, that I'm addressing an unknown item.
Here's a small code snippet to explain it:
<ControlTemplate TargetType="{x:Type ComboBox}">
<Grid>
<Border Background="Green" x:Name="ComboBoxBorder">
<Grid>
<ToggleButton ... />
<TextBox Visibility="Hidden" x:Name="PART_EditableTextBox" ...>
<TextBox.Template>
<ControlTemplate>
<ControlTemplate.Triggers>
<Trigger Property="UIElement.IsKeyboardFocused" Value="True">
<Setter Property="Background" TargetName="ComboBoxBorder" Value="Blue" />
</Trigger>
</ControlTemplate.Triggers>
<ScrollViewer x:Name="PART_ContentHost" Focusable="false" />
</ControlTemplate>
</TextBox.Template>
</TextBox>
</Grid>
</Border>
</Grid>
<!-- more to follow (pop up...) -->
</ControlTemplate>
If somebody could explain to me, why I cannot address the ComboBoxBorder item from the TextBox, that would be really nice. And I would appreciate a working piece of code
Thanks in advance,
Jammni+
|
|
|
|
|
The trigger is not working because it is inside the TextBox control template, but the ComboBoxBorder is in the ComboBox control template. You could try moving the trigger to the ComboBox level.
|
|
|
|
|
Thanks for your answer. But how can I achieve that? I've no idea, how to address the textbox from the border. E.g. I inserted an EventTrigger like:
<Border.Triggers>
<EventTrigger RoutedEvent="GotKeyboardFocus" SourceName="PART_EditableTextBox">
<Setter Property="Background" Value="Orange" />
</EventTrigger>
</Border.Triggers>
But the compiler tells me, that GotKeyboardFocus cannot be converted to a RoutedEvent
Thank you for your help
|
|
|
|
|
Gideon Engelberth wrote: You could try moving the trigger to the ComboBox level.
<ControlTemplate TargetType="{x:Type ComboBox}">
<Grid>
<Border Background="Green" x:Name="ComboBoxBorder">
<Grid>
<ToggleButton ... />
<TextBox Visibility="Hidden" x:Name="PART_EditableTextBox" ...>
</Grid>
</Border>
<Grid>
<!-- other stuff here -->
<ControlTemplate.Triggers>
<!-- your trigger goes HERE -->
<Trigger SourceName="PART_EditableTextBox" Property="UIElement.IsKeyboardFocused" Value="True">
<Setter TargetName="ComboBoxBorder" Property="Background" Value="Blue" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
|
|
|
|