|
Hi Jeremy,
Thanks for the reply, I think this is what I'm after, I'll play with it and let you know
____________________________________________________________
Be brave little warrior, be VERY brave
|
|
|
|
|
I have the following defined in a (merged) resource dictionary:
<Style TargetType="{x:Type TextBox}">
<Setter Property="BorderBrush" Value="Black" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
<Setter Property="Padding" Value="2"/>
<Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="AllowDrop" Value="true"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<Border x:Name="Bd"
CornerRadius="3"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ScrollViewer x:Name="PART_ContentHost"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" TargetName="Bd" Value="Purple" />
</Trigger>
<Trigger Property="IsFocused" Value="True">
<Setter Property="BorderBrush" TargetName="Bd" Value="Purple" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
If I add a TextBox control to a form, it does not use the global style. Why not?
If I put this style into the form's resources section it works. If I try to use it from it's original location in the resource dictionary, it doesn't.
EDIT ===========================
Why was this 1-voted?
"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
modified on Tuesday, July 21, 2009 2:33 PM
|
|
|
|
|
John Simmons / outlaw programmer wrote: Why was this 1-voted?
No idea.
John Simmons / outlaw programmer wrote: Why not?
Again, no idea. I've just taken your implementation and added it into a dummy application - it works perfectly for me. What I did was add a ResourceDictionary and then pasted your code in. Then, I added the ResourceDictionary into app.xaml like this:
<Application x:Class="ThemeTester.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="Window1.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Dictionary.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application> Finally, I added a textbox into a window and it worked perfectly. The only things I can think of are:
1. You haven't merged the resource dictionary in, or
2. You have another style that's being loaded after this one that's overriding the style.
The way to test if it's point 2 is to add this style into a resource dictionary and merge it in as the last style. If it's this problem, the style will start to render properly.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
The way I tried it was to comment out all of the dictionaries that came after the one in question, and it still doesn't work. Does that mean the problem exists in one of the non-dictionary xaml files?
"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: Does that mean the problem exists in one of the non-dictionary xaml files?
I wouldn't have thought it was the problem, but it's worth having a look.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
No joy in Mudville...
"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've just sent you the code I tried. See how it compares.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
I'm about to look at it, but I wanted to be a sarcastic git first.
I think I've simply put too much code into the application, and have overflowed VS2008's sanity buffer.
"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: I think I've simply put too much code into the application, and have overflowed VS2008's sanity buffer.
It's a damned shame that they didn't increase the buffer since VS1.
#define SANITY_BUFFER 2048;
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Here's a new wrinkle for you - when I do this in the textbox element:
Style="{StaticResource {x:Type TextBox}}"
I get the desired results.
Am I correct in assuming that if this works, then my global style is correct and that there is a problem either in the designer or in WPF?
"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: Am I correct in assuming that if this works, then my global style is correct and that there is a problem either in the designer or in WPF?
It would seem logical. Is it something you could send over to me for me to check out? It would be easier for me to diagnose that way.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
I'm not sure that you would get the same results without getting the entire project, and I'm almost positive the boss wouldn't like it if I shipped off the entire project to someone not in our employ. :/
"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
|
|
|
|
|
It's time for you to snoop then, I'm afraid.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Hi there, is anyone familair with or knows if it's possible to create dynamic plugins for a silberlight web project.
For example.
Say you create a silverlight page template showing a banner, menu etc.. and in the middle you have a grid. Now, I've been able to iterate the assembly and create instances of control pages and plop them into the grid, however, I was wondering if it was possible to create control DLL's (based on itnerface) and have them load on demand, as fast as they are dropped into the application BIN folder.
Perhaps even scan a server side bin folder and periodically scan the DLLs.. Any solutions?
thanks
modified 7-Dec-20 21:01pm.
|
|
|
|
|
|
Yes. You can use Composite WPF version 2. OR you can also try Microsoft Extension Framework for Silverlight.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
Microsoft MVP (Silverlight), WPF/Silverlight Insiders
|
|
|
|
|
I'm having a problem positioning elements and not sure where I'm going wrong. The elements are basically ellipsegeometry paths, since all of the elements are have the same radius.x and radius.y I've added a property Radius that I set when I add them.
This code should position them without an overlap and it works fine as long as the elements have the same radius
Public Sub Group2Elements(ByVal Conductor1 As Conductor, ByVal Conductor2 As Conductor, ByVal Angle As Double)
Dim DeltaX As Double = System.Math.Cos(Radians(Angle)) * (Conductor1.Radius + Conductor2.Radius)
Dim DeltaY As Double = System.Math.Sin(Radians(Angle)) * (Conductor1.Radius + Conductor2.Radius)
Dim Cond2Center As Point = New Point(Conductor2.GetValue(Canvas.LeftProperty) + Conductor2.Radius, Conductor2.GetValue(Canvas.TopProperty) + Conductor2.Radius)
Conductor1.SetValue(Canvas.LeftProperty, (Cond2Center.X + DeltaX) - Conductor1.Radius)
Conductor1.SetValue(Canvas.TopProperty, (Cond2Center.Y + DeltaY) - Conductor1.Radius)
End Sub
and the function to convert Degrees to Radians is as follows
Private Function Radians(ByVal Deg As Double) As Double
Radians = Deg * System.Math.PI / 180
End Function
The other problem I'm having is positioning 1 element next to 2 other elements, once again if the elements have the same radius it seems to work.
Public Sub Group3Elements(ByVal Conductor1 As Conductor, ByVal Conductor2 As Conductor, ByVal Conductor3 As Conductor, ByVal Side As Integer)
Dim DeltaX As Double
Dim DeltaY As Double
Dim Angle As Double
Dim aLength, bLength, cLength As Double
Dim aAngle, bAngle, cAngle As Double
aLength = Conductor3.Radius + Conductor1.Radius
bLength = Conductor2.Radius + Conductor1.Radius
cLength = Conductor2.Radius + Conductor3.Radius
aAngle = Degrees(System.Math.Acos((bLength ^ 2 + cLength ^ 2 - aLength ^ 2) / (2 * bLength * cLength)))
bAngle = Degrees(System.Math.Acos((aLength ^ 2 + cLength ^ 2 - bLength ^ 2) / (2 * aLength * cLength)))
cAngle = Degrees(System.Math.Acos((aLength ^ 2 + bLength ^ 2 - cLength ^ 2) / (2 * aLength * bLength)))
If Side = 0 Then
Angle = AngleBetween(Conductor2, Conductor3) - aAngle
Else
Angle = AngleBetween(Conductor2, Conductor3) + aAngle
End If
DeltaX = System.Math.Cos(Radians(Angle)) * (Conductor2.Radius + Conductor1.Radius)
DeltaY = System.Math.Sin(Radians(Angle)) * (Conductor2.Radius + Conductor1.Radius)
Dim Cond2Center As Point = New Point(Conductor2.GetValue(Canvas.LeftProperty) + Conductor2.Radius, Conductor2.GetValue(Canvas.TopProperty) + Conductor2.Radius)
Conductor1.SetValue(Canvas.LeftProperty, (Cond2Center.X + DeltaX) - Conductor1.Radius)
Conductor1.SetValue(Canvas.TopProperty, (Cond2Center.Y + DeltaY) - Conductor1.Radius)
End Sub
and the AngleBeteween code is as follows
Public Function AngleBetween(ByVal Conductor1 As Conductor, ByVal Conductor2 As Conductor) As Double
Dim Angle As Double
Dim Cond1Center As Point = New Point(Conductor1.GetValue(Canvas.LeftProperty) + Conductor1.Radius, Conductor1.GetValue(Canvas.TopProperty) + Conductor1.Radius)
Dim Cond2Center As Point = New Point(Conductor2.GetValue(Canvas.LeftProperty) + Conductor2.Radius, Conductor2.GetValue(Canvas.TopProperty) + Conductor2.Radius)
Angle = Degrees(System.Math.Asin((Cond2Center.Y - Cond1Center.Y) / (Conductor2.Radius + Conductor1.Radius)))
If Cond2Center.X < Cond1Center.X Then Angle = 180 - Angle
AngleBetween = Angle
End Function
and finally the the function to convert Degrees to Radians is
Private Function Degrees(ByVal rad As Double) As Double
Degrees = rad * 180 / System.Math.PI
End Function
Again both Group2Elements & Group3Elements work if the elements all have the same radius if they don't there's no telling where they will end up.
Any help would be appreciated
Thanks
|
|
|
|
|
jward wrote: if the elements have the same radius it seems to work
So, the problem is that if the elements don't have the same radius then it won't work?
Can you send the example project to me so I can take a look and will see whether I can help you to solve the problem or not? My email is mchlsync AT gmail DOT com.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
Microsoft MVP (Silverlight), WPF/Silverlight Insiders
|
|
|
|
|
Hi,
I am new to Windows 7 application development & want to integrate my Application for Windows 7 Taskbar capability.
Before that, I downloaded the sample code from: http://code.msdn.microsoft.com/Windows7Taskbar/Release/ProjectReleases.aspx?ReleaseId=2246[^]
But whenever I run it & try to add a JumpList it throws me COM Exception.
The details of the exception is as below:
<br />
System.Runtime.InteropServices.COMException was unhandled<br />
Message="Exception from HRESULT: 0x80040F03"<br />
Source="Windows7.DesktopIntegration"<br />
ErrorCode=-2147217661<br />
StackTrace:<br />
at Windows7.DesktopIntegration.Interop.ICustomDestinationList.AppendCategory(String pszCategory, IObjectArray poa)<br />
at Windows7.DesktopIntegration.JumpListDestinations.RefreshDestinations(ICustomDestinationList destinationList) in D:\installer\Windows7IntegrationLibrary_Taskbar_Libraries\Windows7IntegrationLibrary_Taskbar_Libraries\DesktopIntegration\Windows7.DesktopIntegration\JumpLists\JumpListImpl.cs:line 62<br />
at Windows7.DesktopIntegration.JumpListManager.Refresh() in D:\installer\Windows7IntegrationLibrary_Taskbar_Libraries\Windows7IntegrationLibrary_Taskbar_Libraries\DesktopIntegration\Windows7.DesktopIntegration\JumpLists\JumpListManager.cs:line 418<br />
at Windows7.DesktopIntegration.MainDemo.Windows7Form.btnBuildJumpList_Click(Object sender, EventArgs e) in D:\installer\Windows7IntegrationLibrary_Taskbar_Libraries\Windows7IntegrationLibrary_Taskbar_Libraries\Demo\Taskbar\Windows7.DesktopIntegration.MainDemo\Windows7Form.cs:line 256<br />
at System.Windows.Forms.Control.OnClick(EventArgs e)<br />
at System.Windows.Forms.Button.OnClick(EventArgs e)<br />
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)<br />
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)<br />
at System.Windows.Forms.Control.WndProc(Message& m)<br />
at System.Windows.Forms.ButtonBase.WndProc(Message& m)<br />
at System.Windows.Forms.Button.WndProc(Message& m)<br />
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)<br />
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)<br />
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)<br />
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)<br />
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)<br />
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)<br />
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)<br />
at System.Windows.Forms.Application.Run(Form mainForm)<br />
at Windows7.DesktopIntegration.MainDemo.Program.Main() in D:\installer\Windows7IntegrationLibrary_Taskbar_Libraries\Windows7IntegrationLibrary_Taskbar_Libraries\Demo\Taskbar\Windows7.DesktopIntegration.MainDemo\Program.cs:line 26<br />
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)<br />
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)<br />
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()<br />
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)<br />
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)<br />
at System.Threading.ThreadHelper.ThreadStart()<br />
InnerException: <br />
<br />
Can anybody in this forum please help me to findout what's the problem is & how can I resolve it.
Any help regarding the same is highly appreciable.
Thanks in advance...
Regards,
- Kunal Chowdhury ( My Blog)
modified on Tuesday, July 21, 2009 6:32 AM
|
|
|
|
|
Did you by any chance visit the Windows 7 Team Blog? They have a recent blog entry regarding coding for jump lists.
"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
|
|
|
|
|
yes.... I also followed the steps from there. In all the cases... it is throwing me the same error.
Regards,
- Kunal Chowdhury ( My Blog)
|
|
|
|
|
|
Thanks Keeron. I got the answer.
Regards,
- Kunal Chowdhury ( My Blog)
|
|
|
|
|
We're in the process of creating a 3D modelling application similar to AutoCAD, but with a twist. It is being written specifically for a furniture manufacturer which will use the application to create 3D representations of his furniture. He will also be able to edit the different parts included in a table for example, widening the parts, adding new parts, etc. So far the user can select a piece of furniture from a database, and then 3D models will be created for each part belonging to the specific piece of furniture. Each part has dimensions which is read from the database, but now, these parts need to be added to the viewport in a specific way so that when the entire model is generated, it actually looks like a table (or whatever furniture was selected). At the moment all the parts overlap beacuse they just get added in a fixed position, and we have to use Mousetracking to move the parts around manually.
Anyone have an idea of how the models can be positioned more efficiently without having to move the models around manually with the mouse?
You can have a look at this amazing Sawdust[^] application to get an idea of what we're trying to accomplish.
|
|
|
|
|
The "easiest" way to do this would be to create a composite model, which is a model of all of the parts added together - you would then add this. This is not a trivial task, because you want to maintain a hierarchy of objects, plus the transformations that need to be applied to them to create the final state.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|