Click here to Skip to main content
15,881,803 members
Home / Discussions / WPF
   

WPF

 
Questionhow to right click on item from Listbox and open menu on WPF Pin
gshhar3-Mar-12 8:34
gshhar3-Mar-12 8:34 
Questionhtml editor Pin
MemberDotNetting2-Mar-12 12:04
MemberDotNetting2-Mar-12 12:04 
AnswerRe: html editor Pin
Pete O'Hanlon2-Mar-12 21:31
mvePete O'Hanlon2-Mar-12 21:31 
AnswerRe: html editor Pin
Abhinav S2-Mar-12 23:10
Abhinav S2-Mar-12 23:10 
QuestionGalaSoft and Events Pin
Kevin Marois2-Mar-12 6:15
professionalKevin Marois2-Mar-12 6:15 
AnswerRe: GalaSoft and Events Pin
SledgeHammer012-Mar-12 6:33
SledgeHammer012-Mar-12 6:33 
GeneralRe: GalaSoft and Events Pin
Kevin Marois2-Mar-12 6:57
professionalKevin Marois2-Mar-12 6:57 
GeneralRe: GalaSoft and Events Pin
SledgeHammer012-Mar-12 7:41
SledgeHammer012-Mar-12 7:41 
LOL, you were the one who asked the question Smile | :) . Anyways, you need to attach the interaction triggers to a Visual, so you need to include the control template unfortunately. The interaction triggers are buried a few lines down Smile | :) . This does seem a little messy. Your other option is to have a reusable control that forwards the ListBoxItem event to the parent ListBox. That's what I do in my framework, but its a bit more work. One other simpler option might be to just trap the ListBox double click and chase up the visual tree to make sure you clicked on a ListBoxItem.

C#
<Style TargetType="{x:Type ListBoxItem}" BasedOn="{StaticResource {x:Type ListBoxItem}}">
	<Setter Property="Template">
		<Setter.Value>
			<ControlTemplate TargetType="{x:Type ListBoxItem}">
				<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
					<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
					<i:Interaction.Triggers>
                                            <!-- INSERT HERE -->
					</i:Interaction.Triggers>
				</Border>
				<ControlTemplate.Triggers>
					<Trigger Property="IsSelected" Value="true">
						<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
						<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
					</Trigger>
					<MultiTrigger>
						<MultiTrigger.Conditions>
							<Condition Property="IsSelected" Value="true"/>
							<Condition Property="Selector.IsSelectionActive" Value="false"/>
						</MultiTrigger.Conditions>
						<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
						<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
					</MultiTrigger>
					<Trigger Property="IsEnabled" Value="false">
						<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
					</Trigger>
				</ControlTemplate.Triggers>
			</ControlTemplate>
		</Setter.Value>
	</Setter>
</Style>

QuestionAdd a new Module for a Prism application (WPF) Pin
radhwane2-Mar-12 6:12
radhwane2-Mar-12 6:12 
AnswerRe: Add a new Module for a Prism application (WPF) Pin
Abhinav S5-Mar-12 20:17
Abhinav S5-Mar-12 20:17 
QuestionChenage windows syle to choose files into listbox Pin
gshhar2-Mar-12 6:08
gshhar2-Mar-12 6:08 
AnswerRe: Chenage windows syle to choose files into listbox Pin
SledgeHammer012-Mar-12 6:35
SledgeHammer012-Mar-12 6:35 
GeneralRe: Chenage windows syle to choose files into listbox Pin
gshhar2-Mar-12 7:18
gshhar2-Mar-12 7:18 
GeneralRe: Chenage windows syle to choose files into listbox Pin
SledgeHammer012-Mar-12 9:10
SledgeHammer012-Mar-12 9:10 
GeneralRe: Chenage windows syle to choose files into listbox Pin
gshhar2-Mar-12 11:31
gshhar2-Mar-12 11:31 
GeneralRe: Chenage windows syle to choose files into listbox Pin
SledgeHammer012-Mar-12 11:48
SledgeHammer012-Mar-12 11:48 
GeneralRe: Chenage windows syle to choose files into listbox Pin
gshhar2-Mar-12 12:09
gshhar2-Mar-12 12:09 
QuestionMVC Pin
MemberDotNetting2-Mar-12 2:36
MemberDotNetting2-Mar-12 2:36 
AnswerRe: MVC Pin
SledgeHammer012-Mar-12 6:34
SledgeHammer012-Mar-12 6:34 
GeneralRe: MVC Pin
MemberDotNetting2-Mar-12 10:09
MemberDotNetting2-Mar-12 10:09 
GeneralRe: MVC Pin
SledgeHammer012-Mar-12 10:40
SledgeHammer012-Mar-12 10:40 
GeneralRe: MVC Pin
MemberDotNetting2-Mar-12 12:01
MemberDotNetting2-Mar-12 12:01 
Questionhow to bind labels in user Control with observablecollection Pin
wasifmuneer1-Mar-12 7:45
wasifmuneer1-Mar-12 7:45 
AnswerRe: how to bind labels in user Control with observablecollection Pin
ekolis1-Mar-12 9:57
ekolis1-Mar-12 9:57 
Questionevent when children added to stackpanel Pin
Sam_lin1-Mar-12 5:31
Sam_lin1-Mar-12 5:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.