|
You are most welcome. Life is good right now - I'm writing a Silverlight app with the Dr Who episode "The Lodger" on in the background.
|
|
|
|
|
Depends. Do you intend to use Expression Blend[^]?
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
Hi,
I am trying to apply a style to a combo box but instead of getting applied the combo box itself disappears. Please check the following xaml code for user control.
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Luna"
x:Class="Guardian.PAS.PASFramework.UI.WPF.PASComboBox"
xmlns:local="clr-namespace:Guardian.PAS.PASFramework.UI.WPF"
Height="26" Width="100" VerticalAlignment="Center" >
<UserControl.Resources>
<Style x:Key="comboBoxStyle" TargetType="{x:Type local:PASCustomComboBox}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:PASCustomComboBox}">
<ControlTemplate.Triggers>
<Trigger Property="local:PASCustomComboBox.IsEnabled" Value="false">
<Setter Property="Background" Value="Red"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Canvas Name="canvas" Height="23" Width="Auto" VerticalAlignment="Center">
<Label Height="23" Name="lblCaption" Width="20" VerticalAlignment="Center">aaa</Label>
<local:PASCustomComboBox Height="23" x:Name="cmbComboBoxControl" VerticalAlignment="Center" Width="50"
IsEditable="True" Style="{StaticResource comboBoxStyle}">
</local:PASCustomComboBox>
<Button Height="23" Name="btnSearch" Width="25" Click="btnSearch_Click" Visibility="Collapsed"
VerticalAlignment="Center">...</Button>
<Label Height="23" Name="lblDescription" VerticalAlignment="Center" Width="20" Foreground="Blue">
</Label>
</Canvas>
</UserControl>
Here PASCustomComboBox is a class which inherites from combo box.
public class PASCustomComboBox : ComboBox
{
protected override void OnPreviewKeyDown(KeyEventArgs e)
{
if (e.Key == Key.Down || e.Key == Key.Up)
{
e.Handled = true;
return;
}
base.OnPreviewKeyDown(e);
}
}
Please help!
Thanks in advance!
Regards,
Samar
|
|
|
|
|
When you set the Template property for a control, you're replacing the control with whatever is inside the template... In this case, you're replacing it with nothing, since the only thing you put inside your custom template is a trigger.
|
|
|
|
|
Oh... Then what should i write in the control template to show the current combo box as it is??? I am a little weak in xaml..!!
|
|
|
|
|
Don't use the Template unless you plan on replacing the entire control.
|
|
|
|
|
I have some user control that i wrote in simple C# winform.
I want to add it into WPF Window.
How can i do it ?
Thanks.
|
|
|
|
|
Probably this is not possible. I never tried. The reason behind is, WPF UI is designed using XAML code, so if you want to use it as XAML code it will not work. In the other hand, from the code behind I am not sure. But I think, it will not work.
Don't forget to Click on [Vote] and [Good Answer] on the posts that helped you.
Regards - Kunal Chowdhury | Software Developer | Chennai | India | My Blog | My Tweets | Silverlight Tutorial
|
|
|
|
|
Thanks,
I already found how to do it.
It is possible and its work fine.
This can be done by using 'WindowsFormsIntegration' on the xaml.
I found the example here[^]
|
|
|
|
|
Woh that's great. I was not aware of it. Actually I never worked with WinForm. Thanks for sharing the link.
Don't forget to Click on [Vote] and [Good Answer] on the posts that helped you.
Regards - Kunal Chowdhury | Software Developer | Chennai | India | My Blog | My Tweets | Silverlight Tutorial
|
|
|
|
|
i have some third party dll that can't work with WPF (just with winform)- so this is the reason i needed to do it.
|
|
|
|
|
Can be possible - this might give you some ideas[^].
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
|
Hi;
I'm new to WPF, and I'm trying to understand the underlying architecture, so please correct me if I'm wrong:
As far as I know, there are three possibilities to dynamically transform a GeometryModel3D during runtime:
a) Set the model's Transform-property to a Transform3DGroup once, to which you add new / duplicate Transformations.
b) Cast the model's Transform-property as a MatrixTransform3D and multiply its matrix with the Value-property of a Transformation (which i guess is pretty much case (a) )
c) Leave the Transform-property as a identity matrix and instead transform the model's Geometry.Positions property directly (provided you use a MeshGeometry3D) like such:
int i;
MeshGeometry3D mesh;
mesh = (_SomeModel.Geometry as MeshGeometry3D);
for (i = 0; i < mesh.Positions.Count; i++)
{
mesh.Positions[i] = _SomeTransform.Transform(
mesh.Positions[i]);
}
On first glance, option (c) seems like the best (though not most intuitive) choice, especially when you need the actual positions of the model(s); for example to calculate hit-detection.
Is there another way to easily access a model's current, transformed position(s)? And why does WPF transform a model's own space instead of just the actual coordinates?
Kind regards, Frank
|
|
|
|
|
I don't think (c) seems like the best option, although there are some scenarious where it might be appropriate to transform each vertex (or "position") directly...
The Transform property is there for a reason. You can move, rotate, scale etc. the entire model by setting just one matrix. That's far easier than transforming each vertex.
There is also a good reasony why WPF stores the positions relative to the model's coordinate system. This is actually how almost every CAD program and 3D engine works. Most of the time when you are editing the shape of a model you don't really care how the model is oriented and transformed, because you only pay attention to the shape itself, that's why relative coordinates are useful. You can always get the global coordinates easily by using the model's transformation matrix.
One more thing: moving each vertex of the model might be a lot slower than transforming the whole model at once. It depends on the implementation of the 3D engine, but if you set the Transform property of the model, the transformation of all vertices might be hardware accelerated, while transforming each vertex individually will definitely run on the CPU.
I can't answer your question ("which method is the best") because it depends on your application... But I would try to avoid option (c).
|
|
|
|
|
Hi we are working with WPF ribbon control.....
But finding some problem with it...Like Ribbon Application Menu if we want to remove it using XAML code den we r not able to do dat...
|
|
|
|
|
Your question is not very clear.
Maybe posting some code here can help!
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
Any idea how to do this? Auto completing multiple values separated by comma into a single autocompletebox. Something similar to gmail to/cc/bcc address textbox.
|
|
|
|
|
You might want to inherit the existing AutoCompleteBox control and right your own one.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
Hi,
I'm trying to create a custom control that behaves like an horizontal StackPanel that hosts hyperlinks (with rich ToolTip).
A major difference is that I want to have horizontal scrollbar and keep the size of the control as one line of text.
I did it by inherit from ListBox and set my own Template, ItemsPanel and ItemTemplate.
It worked fine when I did all the work in my test WPF application, but when I moved the code to a class library, like it should be, I have a problem with the scrollbar.
When the width of the control if too short, a scrollbar thumb apears (I deleted it in my control!) and hides my links.
Also, I can not click the links or see the ToolTips because when the mouse is over the control the scrollbar takes control.
It is hard to show code here because then I would need to show all the Generic.xaml, instead I uploaded the whole solution (very small):
Code Here
How do I cancel this behavior?
Thanks,
Yariv
|
|
|
|
|
Solved. It was a problem of hidden VisualState (MouseOver).
I just copied the default ScrollBar style from the MSDN (instead of using the template the Expression created for me), then edited what I want and...it works.
Thanks
|
|
|
|
|
Thanks for posting the solution here.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
Hi,
I created new ResourceDictionary - This Resource is actually a button.
I want to add some behavior to this button => in case the user will press on the button then the button will
stay in "press" state until the user will "press" it again ( something like Caps Lock ) and i don't know how to do it.
I have on my code Trigger that will call and change the button color to 'red' color in case the user press on it - but the color will be 'blue' again ( the original color ) when the user stop pressing on the button.
How can i do it ?
Thanks for The help.
|
|
|
|
|
There is a control called ToggleButton that does exactly what you need.
|
|
|
|
|
Hi
I have a very basic WPF question. Please forgive my
ignorance.
I have Visual Studio Solution with two VB Projects:
Project A is a WPF program that contains x, x being an ObservableCollection(of Rec) where rec is a Class of some database record.
Project B is a UserControl uc, containing, amongst other things a ListBox lb. The problem is how to display the x items in lb. Project A contains several instances of uc.
Possible solution 1:
Is there a way that I can bind lb directly to x? I seem to be unable to do so.
Possible solution 2:
Should I define a dependency property of ObservableCollection(of Rec) in B and give that a value in the Xaml of the uc instances. This also fails! Conceptually, this method has me worried, because I cannot see how uc obtains the rec info for formatting the records
in its DataTemplate. I have to define the Property as a ObservableCollection(of Object) to get past the compiler!
Possible solution 3.
It cannot be done!
BTW, I know enough to display x in a listbox defined in A quite nicely with a DataTemplate.
I have searched Google long and hard without finding anything that throws light on my dilemma! Any insight will be much appreciated.
David
|
|
|
|