|
I have a Border inside a DataTemplate for a ListBox. When the mouse is over the item, I want to show the Border. Here's my XAML:
<ListBox Grid.Row="3"
Grid.Column="0"
ItemsSource="{Binding Devices}"
SelectedItem="{Binding SelectedDevice}"
MaxWidth="350">
<ListBox.Resources>
<Style TargetType="ListBoxItem">
<Style.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent"/>
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent"/>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black"/>
</Style.Resources>
</Style>
</ListBox.Resources>
<ListBox.ItemTemplate>
<DataTemplate>
<Border BorderBrush="SteelBlue"
BorderThickness="0"
HorizontalAlignment="Stretch"
CornerRadius="3"
MinHeight="65"
Margin="3">
<Border.Style>
<Style>
<Style.Triggers>
<Trigger Property="Border.IsMouseOver" Value="True">
<Setter Property="Border.BorderThickness" Value="1" />
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Image Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="0"
Source="/DFT.Falcon6.UI.Desktop;component/Media/Images/fc6logo.png"
Height="50"
Width="50"
Margin="5"/>
<TextBlock Grid.Row="0"
Grid.Column="1"
Text="{Binding UnitIdentifier}"
Style="{StaticResource devicetextStyle}"
Margin="2"/>
<TextBlock Grid.Row="1"
Grid.Column="1"
Text="{Binding IPAddress}"
Style="{StaticResource devicetextStyle}"
Margin="2"/>
</Grid>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
You can see that I have a trigger defined in the Border control to set the BorderThickness to 1. However when I run it and mouse over the item, nothing happens.
What am I doing wrong here?
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
In a dodge to get around the policy where we do not have access to the UAT servers I need to execute a stored procedure after a click once publish event. The proc will copy the published files to the deployment folder on the UAT server which SQL Server can see but the developers cannot.
This is currently being done by opening up MSSQL and executing the scripts, I would like to automate that by including a Post Deployment action but there does not seem to be such a creature!
Any suggestions...
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Ehm, any reason that the question is posted under Silverlight/WPf forum?
|
|
|
|
|
Click once, WPF application. Possibly should be in the VS forum!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
Please share the video tutorial source for Entity Framework which uses WPF app as example.
|
|
|
|
|
|
Any free video tutorial web link
|
|
|
|
|
Hello team,
I have to develop a WPF based windows App that run on tablets (be pc tablet or which ever tablet family). I dont have to sell the app, its for internal use. Now, what is the type of app i have to do for?
1. Windows store app ? or windows desktop app?
what is this WindowsRT apps?
My system environment is:
1. HP elitebook revolve 810 tablet pc.
2. windows 8.1 x64 bit.
3. visual studio 2012 express.
I am confused and not able to choose the right documents to read from the msdn website. Please help
|
|
|
|
|
<Window x:Class="WpfTst1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="HTM Service Tool" WindowState="Maximized" WindowStartupLocation="CenterScreen"
FontFamily="Global San Serif" FontSize="14" Icon="pack://application:,,,/Resource/Icon/Truck16X16.ico"
>
<Window.Background>
<ImageBrush ImageSource="pack://application:,,,/Resource/Image/H1.jpg"></ImageBrush>
</Window.Background>
<Grid >
<Menu Height="24" IsMainMenu="True" VerticalAlignment="Top" HorizontalAlignment="Left" >
<MenuItem x:Name="FileMnu" Header="_File" HorizontalAlignment="Left" >
<MenuItem Header="_Login" ></MenuItem>
<MenuItem Header="_Exit" > </MenuItem>
</MenuItem>
</Menu>
</Grid>
</Window>
Don't know why the Fontsize="14" attribute not works on MenuItem, File,Login,Exit.
|
|
|
|
|
Because the default style applied to all Menu controls overrides the font size:
<Style TargetType="{x:Type Menu}">
<Setter Property="TextElement.FontSize">
<Setter.Value>
<DynamicResource ResourceKey="{x:Static SystemFonts.MenuFontSizeKey}" />
</Setter.Value>
</Setter>
</Style>
As documented on MSDN[^], values set in a Style override values inherited from parent controls.
You either need to set the font size explicitly on the Menu , or create and apply a new Style for the Menu .
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
HI All,
Can any one share sample code where using tree view with check box based on below data dynamically.
Also how can i read which check box is selected or not mean how i can read check box value whether its selected or not thru loop.
{ Name = "R1", Id = 1, ParentId = 0 },
{ Name = "R2", Id = 2, ParentId = 0 },
{ Name = "R3", Id = 3, ParentId = 0 },
{ Name = "D1R1", Id = 4, ParentId = 1 },
{ Name = "D2R2", Id = 5, ParentId = 2 },
{ Name = "D3R3", Id = 6, ParentId = 3 },
{ Name = "T1D2R2", Id = 7, ParentId = 5 },
{ Name = "T2D2R2", Id = 8, ParentId = 5 },
{ Name = "T3D1R1", Id = 9, ParentId = 4 },
{ Name = "T4D3R3", Id = 10, ParentId = 6 },
{ Name = "T5D3R3", Id = 11, ParentId = 6 },
{ Name = "D4R3", Id = 12, ParentId = 3 },
{ Name = "D4R3", Id = 13, ParentId = 3 }
|
|
|
|
|
|
At one time the Epxression Blend team had one available[^] but the download link no longer works.
I was able to get the assembly, but I'd like the code.
Anyone have one of these, or know of one? Source would be nice.
If it's not broken, fix it until it is
|
|
|
|
|
|
|
Yes. It's pointing to the same page I posted
If it's not broken, fix it until it is
|
|
|
|
|
You have his e-mail then....
|
|
|
|
|
I can try.. Did you see the date on that page.. 24 Oct 07
If it's not broken, fix it until it is
|
|
|
|
|
|
That's a blog pointing to the page with the source. The source page is 2007. The download link doesn't work.
I'll email the blogger, but I think it's a stretch.
If it's not broken, fix it until it is
|
|
|
|
|
I'm going to be controlling a camera... tilt/pan/zoom.
Anyone know of a joystick type of control for use in WPF? Something that looks like the little joystick on a game controller would be nice.
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
|
I created a WPF (.Net 4) UserControl containing some ComboBoxes and a TextBox. In XAML, some ValidationRules are bound to the TextBox. If the TextBox contains invalid data, a red frame is shown, and the tooltip is set to the error description. Works well.
Next, I placed two instances of that UserControl on a form, and added a button. In XAML, the button is connected to a RelayCommand of the ViewModel. Now I want the button to be enabled only when both of the UserControls contain valid data only.
Not a problem, I thought, let me use a strategy which works elsewhere. I added a trigger:
<Button Content="_OK" ... Command="{Binding Path=OKCommand}">
<Button.Style>
<Style TargetType="{x:Type Button}">
<Setter Property="IsEnabled" Value="false" />
<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding ElementName=cascadingComboFrom, Path=(Validation.HasError)}" Value="false" />
<Condition Binding="{Binding ElementName=cascadingComboTo, Path=(Validation.HasError)}" Value="false" />
</MultiDataTrigger.Conditions>
<Setter Property="IsEnabled" Value="true" />
</MultiDataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
But there is a catch: Validation.HasError is always false for the UserControls - the Validation failed for an element inside the UserControl, not for the UserControl proper.
I know that I can register the Click event of the button, check the validity there using the method shown in http://stackoverflow.com/questions/127477/detecting-wpf-validation-errors[^], and prevent the execution of the RelayCommand by setting the Handled property of the RoutedEventArgs to true. But that looks more like WTF than WPF.
What do you suggest? How can I retrieve the Validation Errors of the UserControl's children? Or how can I get them in the RelayCommand's CanExecute method? Or some other tricks?
|
|
|
|
|
Rather than basing your validation on the UI, it's helpful to base it on the underlying ViewModel instead. A relatively simplistic approach is outlined in this[^] article.
|
|
|
|
|