|
I think it's a feature.
WPF has theming capabilities and use different default themes on different OSes.
To play with themes, have a look there[^]
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Hi and thanks
But i don't understand how is it a feature? and how is the themes gonna help me.
as remembered, all i want to do is color the foreground color of my menu items in white, while the rest will stay default.
and for it to work in XP\Vista\Windows 7
And i can't
does anybody have a solution to that?
Thanks again
|
|
|
|
|
It's the way the menu behave!
How is it done and different depending on the platform in WPF?
Well, WPF ship with a few build-in theme. Aero is the vista look, Luna is the XP look (if I'm right).
Then the theming capabilities of WPF choose the appropriate default look for the OS.
If you want your menu to look always the same you got to either of:
1. fix the theme so that it doesn't change with the OS
2. or simply set up a MenuItem style in your App.config.
Fix the theme will ensure that your app looks the same whatever the UI and will get you a deeper understanding of what's going on. (As writing a them is huge undertaking, better re-us an existing one).
Write a custom MenuItem style is a less general solution (it will only make the menu similar, but the you'll got the same problem for scrollbar, button, combobox, etc.....)
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Ok now i see what you mean
I've set my project to work with Luna (XP) only (in the App Resource)
Unfortunatley, it doesn't solve the problem...
|
|
|
|
|
Hi
I get very poor performance when rotating or moving 3d models. At first I thought it might be the TrackBall from the 3DTools library, so I reverted back to using sliders, but I was still getting poor performance. The models lag when rotating and it gets pretty irritating. Also, I'm reading dimensions out of an Access database and then use these dimensions to construct the 3D models, so it might be because of this? I'm only using one connection string.
Is my application staying connected to the database the whole time? Do I need to disconnect somehow?
|
|
|
|
|
You need a profiler utility to let you know where your processing time is too high. Get ANTS.
"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
|
|
|
|
|
Okay thanks I'll try ANTs. I used another app called dotTrace, which gave me a snapshot of the running app, showing a lot of processes getting called quite a few times. I thought it might have been these processes and methods causing the lag, but when I ran dotTrace on another app that runs fine, it gave me an almost similar snapshot, so it can't be these specific processes. I'll still try ANTs though.
|
|
|
|
|
Hi,
Am very new to silverlight, and am working on this module where i want to retrieve some data from database, the problem is when i mention column names it dosnt work properly and it gives an error at the return statement....the code is below...
Public Function GetLoginName(ByVal strLogin As String) As List(Of tbl_User) Implements IService1.GetLoginName
Dim db As New DataClasses1DataContext
Dim matchingLogin = From Login In db.tbl_Users Where Login.UserName.StartsWith(strLogin) _
Select Login.UserName, Login.Password
Return matchingLogin
End Function
Can any1 tell me how to achieve it ..
Thanks in advance
|
|
|
|
|
Are you writing this code in Webservice (not Silverlight)? Then, it is not probably Silverlight problem. Never mind, we can still help.
What error are you getting now? What is "strLogin" or What do you have in "db.tbl_Users"?
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
Microsoft MVP (Silverlight), WPF/Silverlight Insiders
|
|
|
|
|
Ya you are right am writing this code in web.service, "strlogin" contains the keyword depending on which i have to retrieve data from database. What am trying to do here is retrieve username and password from table tbl_user.
Am getting the following error
Unable to cast object of type 'System.Data.Linq.DataQuery`1[VB$AnonymousType_0`2[System.String,System.String]]' to type 'System.Collections.Generic.List`1[E_Learning.Web.tbl_User]'.
Is there any other way to retrieve data from database without using webservice, am very new 2 silverlight and dont know much about it, any support will be of great help.
|
|
|
|
|
I don't have VB in my VS. But I guess you will need to cast it before returning the object.
Return matchingLogin.ToList()
sunil.n.cs wrote: Is there any other way to retrieve data from database without using webservic
If you are using silverlight-ported object database like db4o or silverlightdb then you can retrieve the data without using any web service. Otherwise, No.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
Microsoft MVP (Silverlight), WPF/Silverlight Insiders
|
|
|
|
|
I already tried casting before returning the object, it works fine until i dont mention any column names in select, if i do mention any column names as in this case den i get the following error when i try to cast.
Value of type 'System.Collections.Generic.List(Of <anonymous type="">)' cannot be converted to 'System.Collections.Generic.List(Of E_Learning.Web.tbl_User)'.
|
|
|
|
|
As Michael said, you need to do:Return matchingLogin.ToList() . The reason you have to do this is because Linq uses a technique called deferred execution (please Google and have a read about this feature), which means that matchingLogin is actually IQueryable(Of tbl_User) .
If you think about this, it makes a lot of sense because there are so many different operations that you could perform here on your select that you need to tell it which one you want. For instance, you could return a single row using SingleOrDefault. The onus is on you to tell the query which one you want, hence you use Return matchingLogin.ToList() .
"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
|
|
|
|
|
First of all i would like to thank u guys for the support u have been providing. Now as i mentioned in my last reply i am using deferred execution i.e :Return matchingLogin.ToList()...this will work fine for the query
Dim matchingLogin = From Login In db.tbl_Users Where Login.UserName.StartsWith(strLogin) _
Select Login
Return matchingLogin.ToList()
But when i use column names in select like this one
Dim matchingLogin = From Login In db.tbl_Users Where Login.UserName.StartsWith(strLogin) _
Select Login.UserName, Login.Password
Return matchingLogin.ToList()
it gives me a error in blue underline for matchingLogin.ToList() and when i move the mouse on top it, it says
Value of type 'System.Collections.Generic.List(Of )' cannot be converted to 'System.Collections.Generic.List(Of E_Learning.Web.tbl_User)'.
So to remove this error i have removed .Tolist() from Return
|
|
|
|
|
Ah - sorry, I missed the bit where you picked out the smaller set of data. The problem you've got here, is that you've created an anonymous class in the Select . If you want to return the whole class, use Select Login instead, which selects the lot for you.
"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 dont want to take the whole class, i want to take smaller set i.e only the required amount data from the database, is it that der is no option to take only required amount of data(Column selection option) here.
|
|
|
|
|
Then you'll have to create a class that matches these columns and return a list of that class instead. You'll use the select projection to fill that class.
"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
|
|
|
|
|
Thanks a lot, if possible can u plz give me an example on how to achieve it.
|
|
|
|
|
Bear in mind that I'm a C# developer (not a VB.NET one), so I may not get the syntax 100% correct, but I should imagine that this will work:
Public Function GetLoginName(ByVal strLogin As String) As List(Of UserSubset)
Implements IService1.GetLoginName
Dim db As New DataClasses1DataContext
Dim matchingLogin = From Login In db.tbl_Users Where Login.UserName.StartsWith(strLogin) _
Select New UserSubset With {.Name = Login.UserName, .Password = Login.Password }
Return matchingLogin.ToList
End Function You will need to create a class called UserSubset that contains the properties Name and Password . That should be good enough to get you started.
"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
|
|
|
|
|
Thanks Pete O'Hanlon, i will try this out.
|
|
|
|
|
Hi, I am using Visual Studio 2008 for building WPF 3.5 SP1 application.
I came up with a problem which I need to develop. Hope you guys can help me...
I need to create an application which will load images dynamically & position them in the screen randomly. I need to show maximum 10 images & they should not overlap each other.
Here is the sample view:
Problem Statement (ScreenShot)[^]
There will be a central image at position 'B' and the rest of the images will be in various locations 'X' connected with 'B'.
How can I implement the logic? As the images will be dynamic & can vary from 2-10 images. Please guide me with proper solution.
Regards,
- Kunal Chowdhury ( My Blog)
|
|
|
|
|
You generate random numbers and then reject them if they overlap with any existing image.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi friend
i want to create custom Expander control. in my expander control there will be three or four more button they will have to register there cick event where ever my custom control is used.
Now i create new custom control inherit it from Expander and Now how i can add my desired buttons and there Click event plz help me?????
WANTED wasim khan(Killed 50 Innocent Buggs, Distroyed 200 Exception, make 5 Project Hostage) any Compnay Hire him will pay 30,000. Best place where u can get him is Sorcim Technologies Murre Road RWP
|
|
|
|
|
Why not restyling the Expander control?
A good starting point is simply to take the default style / template and modify it.
I don't know if there is a well known place to find the Aero template, so I just use Reflector to uncompile the XAML resource file for the WPF UI Control.
For your convenience here is the default aero style of the expander:
<Style x:Key="{x:Type Expander}" TargetType="{x:Type Expander}">
<Setter Property="Foreground" Value="{DynamicResource {x:Static ControlTextBrush}}" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Expander}">
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="true">
<Setter TargetName="ExpandSite" Property="Visibility" Value="Visible" />
</Trigger>
<Trigger Property="ExpandDirection" Value="Right">
<Setter TargetName="ExpandSite" Property="Dock" Value="Right" />
<Setter TargetName="HeaderSite" Property="Dock" Value="Left" />
<Setter Value="{StaticResource Ó}" TargetName="HeaderSite" Property="Style" />
</Trigger>
<Trigger Property="ExpandDirection" Value="Up">
<Setter TargetName="ExpandSite" Property="Dock" Value="Top" />
<Setter TargetName="HeaderSite" Property="Dock" Value="Bottom" />
<Setter Value="{StaticResource Ô}" TargetName="HeaderSite" Property="Style" />
</Trigger>
<Trigger Property="ExpandDirection" Value="Left">
<Setter TargetName="ExpandSite" Property="Dock" Value="Left" />
<Setter TargetName="HeaderSite" Property="Dock" Value="Right" />
<Setter Value="{StaticResource Ô}" TargetName="HeaderSite" Property="Style" />
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Value="{DynamicResource {x:Static GrayTextBrush}}" Property="Foreground" />
</Trigger>
</ControlTemplate.Triggers>
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="3" SnapsToDevicePixels="true">
<DockPanel>
<ToggleButton Name="HeaderSite" Dock="Top" Margin="1" MinWidth="0" MinHeight="0" Style="{StaticResource Ñ}" FocusVisualStyle="{StaticResource Ò}" Content="{TemplateBinding Header}" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" Foreground="{TemplateBinding Foreground}" Padding="{TemplateBinding Padding}" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStyle="{TemplateBinding FontStyle}" FontStretch="{TemplateBinding FontStretch}" FontWeight="{TemplateBinding FontWeight}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" IsChecked="{Binding Path=IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" />
<ContentPresenter Name="ExpandSite" Dock="Bottom" Visibility="Collapsed" Focusable="false" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" />
</DockPanel>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
thnx buddy.
i solve the problem by creating the custom control for the Expander. take idea from( Form link
)
i add the buttons in template here is the xaml
<Style TargetType="{x:Type local:CustomControl1}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:CustomControl1}">
<ControlTemplate.Resources>
<OuterGlowBitmapEffect x:Key="outerGlow" GlowColor="Brown" GlowSize="0"></OuterGlowBitmapEffect>
<!-- Style for the toggle button which wil be used as expander header -->
<Style TargetType="{x:Type ToggleButton}" x:Key="toggleButtonKey">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Border Background="White">
<Grid Background="Aquamarine"
Margin="{TemplateBinding Padding}">
<ContentPresenter ContentSource="{TemplateBinding Content}" Margin="5"/>
<Grid Background="Transparent">
<Ellipse x:Name="shadow" Visibility="Hidden"
HorizontalAlignment="Center" VerticalAlignment="Center"
Width="17" Height="17" />
<Path x:Name="arrow"
VerticalAlignment="Center" HorizontalAlignment="Center"
Stroke="#666" StrokeThickness="2"
Data="M1,1 L4,4 7,1" />
</Grid>
</Grid>
</Border>
<ControlTemplate.Triggers>
<!-- Trigger to change the arrow direction when expanded -->
<Trigger Property="IsChecked" Value="true">
<Setter TargetName="arrow"
Property="Data" Value="M 1,4 L 4,1 L 7,4"/>
</Trigger>
<!-- Trigger to give a mouse over effect on the circle containing direction arrow -->
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="arrow"
Property="Stroke" Value="#222"/>
<Setter TargetName="shadow"
Property="Visibility" Value="Visible"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ControlTemplate.Resources>
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
<!-- Expander -->
<StackPanel>
<!-- Expander Header -->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<ToggleButton x:Name="expanderHeader" Grid.Column="0" HorizontalAlignment="Left"
Width="{TemplateBinding Width}"
Style="{StaticResource toggleButtonKey}"
Content="{TemplateBinding Header}"
Padding="{TemplateBinding Padding}"
IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsExpanded,Mode=TwoWay}"/>
<StackPanel Orientation="Horizontal" Grid.Column="1">
<Button x:Name="btnHistory" Content="History"/>
<Button x:Name="btnNotes" Content="Notes"/>
<Button x:Name="btnMedication" Content="Medication"/>
</StackPanel>
</Grid>
<!-- Expander Content -->
<ContentPresenter x:Name="expanderContent"/>
</StackPanel>
</Grid>
</Border>
<ControlTemplate.Triggers>
<!-- Trigger for showing the popup when Expander control is not expanded and IsMouseOver is true -->
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition SourceName="expanderHeader" Property="IsMouseOver" Value="True"></Condition>
<Condition SourceName="expanderHeader" Property="IsChecked" Value="False"></Condition>
</MultiTrigger.Conditions>
</MultiTrigger>
<!-- Trigger for setting the content of expander when IsExpanded is true -->
<Trigger SourceName="expanderHeader" Property="IsChecked" Value="True">
<Setter TargetName="expanderContent"
Property="Visibility" Value="Visible"></Setter>
</Trigger>
<Trigger SourceName="expanderHeader" Property="IsChecked" Value="False">
<Setter TargetName="expanderContent"
Property="Visibility" Value="Collapsed"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
and in CustomControl.cs i added
public CustomControl1()
{
this.Loaded += new RoutedEventHandler(CustomControl1_Loaded);
}
void CustomControl1_Loaded(object sender, RoutedEventArgs e)
{
Button btn = Template.FindName("btnHistory", this) as Button;
if (btn != null)
{
btn.Click += new RoutedEventHandler(btn_Click);
}
Button btnNotes = Template.FindName("btnNotes", this) as Button;
if (btnNotes != null)
{
btnNotes.Click += new RoutedEventHandler(btnNotes_Click);
}
Button btnMedcation = Template.FindName("btnMedication", this) as Button;
if (btnMedcation != null)
{
btnMedcation.Click += new RoutedEventHandler(btnMedcation_Click);
}
}
is this is right approach or not.
plz reply
WANTED wasim khan(Killed 50 Innocent Buggs, Distroyed 200 Exception, make 5 Project Hostage) any Compnay Hire him will pay 30,000. Best place where u can get him is Sorcim Technologies Murre Road RWP
|
|
|
|