Themes - QuickNewMachineWindow : unable to override defaults

Post Reply
User avatar
strobotone
Posts: 297
Joined: Wed Nov 23, 2011 2:59 pm
Location: berlin
Contact:

Themes - QuickNewMachineWindow : unable to override defaults

Post by strobotone »

Hi,

for some reason i am unable to override the default style of the QuickNewMachine Window.

i added a style (with a ControlTemplate) to MachineView.xaml :
<Style TargetType="{x:Type local:QuickNewMachineWindow}">
...

Although it is within the namespace of BuzzGUI.MachineView nothing happens.
Am i missing something?

Thanks !
oskari
Site Admin
Posts: 296
Joined: Mon Nov 21, 2011 2:04 pm

Re: Themes - QuickNewMachineWindow : unable to override defa

Post by oskari »

I'll have to update it to load the resource dictionary.
oskari
Site Admin
Posts: 296
Joined: Mon Nov 21, 2011 2:04 pm

Re: Themes - QuickNewMachineWindow : unable to override defa

Post by oskari »

QuickNewMachineWindow, CreateTemplateWindow, LatencyWindow, CPUMonitorWindow and HDRecorderWindow should now support MachineView.xaml resources.
User avatar
strobotone
Posts: 297
Joined: Wed Nov 23, 2011 2:59 pm
Location: berlin
Contact:

Re: Themes - QuickNewMachineWindow : unable to override defa

Post by strobotone »

oops. many thanks Oskari !
Works now.
User avatar
strobotone
Posts: 297
Joined: Wed Nov 23, 2011 2:59 pm
Location: berlin
Contact:

Re: Themes - QuickNewMachineWindow : unable to override defa

Post by strobotone »

i made this template for the window but the actual search and doubleclick function does not work.
how can i make the handler getting recognized?

<!--QuickNewMachineWindow Template-->
<Style x:Key="ItemStyle" TargetType="{x:Type ListBoxItem}">
<!--<EventSetter Event="MouseDoubleClick" Handler="OnDoubleClickItem" />-->
</Style>

<DataTemplate x:Key="MachineListItemTemplate">
<TextBlock Text="{Binding Path=DisplayName}" Foreground="#cccccc"/>
</DataTemplate>

<Style TargetType="{x:Type local:QuickNewMachineWindow}">
<Setter Property="AllowsTransparency" Value="True"/>
<Setter Property="MinWidth" Value="200"/>
<Setter Property="MinHeight" Value="323"/>
<Setter Property="SizeToContent" Value="Width"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:QuickNewMachineWindow}">
<Border BorderBrush="#c0111111" BorderThickness="2" CornerRadius="3" >
<Border Background="#e0080808"
BorderBrush="#cccccc"
BorderThickness="2"
CornerRadius="3"
Padding="2">

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="24"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>

<Border Grid.Row="0"
BorderBrush="#666"
BorderThickness="1"
CornerRadius="2"
Margin="3">
<TextBox Name="textBox"
BorderThickness="0"
Background="#e3282828"
Foreground="#eeeeee"/>
</Border>

<Border Grid.Row="1"
BorderBrush="#666"
BorderThickness="1"
CornerRadius="2"
Margin="3"
Padding="2">
<ListBox Name="listBox"
ItemsSource="{Binding Path=Items}"
ItemContainerStyle="{StaticResource ItemStyle}"
ItemTemplate="{StaticResource MachineListItemTemplate}"
VirtualizingStackPanel.IsVirtualizing="True"
BorderThickness="0"
Padding="0,0,8,0">
<ListBox.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
<GradientStop Offset="0" Color="#e8080808"/>
<GradientStop Offset="1" Color="#e8161616"/>
</LinearGradientBrush>
</ListBox.Background>
</ListBox>
</Border>

</Grid>
</Border>
</Border>

</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Attachments
qnmw02.jpg
qnmw02.jpg (40.48 KiB) Viewed 6854 times
qnmw01.jpg
qnmw01.jpg (46.49 KiB) Viewed 6854 times
oskari
Site Admin
Posts: 296
Joined: Mon Nov 21, 2011 2:04 pm

Re: Themes - QuickNewMachineWindow : unable to override defa

Post by oskari »

It's not possible to change the whole ControlTemplate because of the way it's written. I'll change it for the next build but I'm probably not going to do it for all the windows. The alternative is to only change styles of the controls that are used.
oskari
Site Admin
Posts: 296
Joined: Mon Nov 21, 2011 2:04 pm

Re: Themes - QuickNewMachineWindow : unable to override defa

Post by oskari »

It should work in 1442. The names and the way double-click is handled have changed a bit.
User avatar
strobotone
Posts: 297
Joined: Wed Nov 23, 2011 2:59 pm
Location: berlin
Contact:

Re: Themes - QuickNewMachineWindow : unable to override defa

Post by strobotone »

i see. thanks for the info!

but it does not seem to work from the Style:
<Style x:Key="ItemStyle" TargetType="{x:Type ListBoxItem}">
<EventSetter Event="MouseDoubleClick" Handler="OnDoubleClickItem" />
</Style>

even though it is the same used in QuickNewMachineWindow.
Attachments
em00.jpg
Last edited by strobotone on Thu Feb 02, 2012 8:40 pm, edited 1 time in total.
oskari
Site Admin
Posts: 296
Joined: Mon Nov 21, 2011 2:04 pm

Re: Themes - QuickNewMachineWindow : unable to override defa

Post by oskari »

Oops, it's still broken, but this will work in 1443:

Code: Select all

	<!--QuickNewMachineWindow Template-->
	<DataTemplate x:Key="MachineListItemTemplate">
		<TextBlock Text="{Binding Path=DisplayName}" Foreground="#cccccc"/>
	</DataTemplate>

	<Style TargetType="{x:Type local:QuickNewMachineWindow}">
		<Style.Resources>
			<Style x:Key="ItemStyle" TargetType="{x:Type ListBoxItem}">
				<Setter Property="bgc:CommandBehavior.Event" Value="MouseDoubleClick" />
				<Setter Property="bgc:CommandBehavior.Command" Value="{Binding ElementName=PART_Window, Path=SelectCommand}" />
				<Setter Property="bgc:CommandBehavior.CommandParameter" Value="{Binding}" />
			</Style>
		</Style.Resources>
		<Setter Property="AllowsTransparency" Value="True"/>
		<Setter Property="MinWidth" Value="200"/>
		<Setter Property="MinHeight" Value="323"/>
		<Setter Property="SizeToContent" Value="Width"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type local:QuickNewMachineWindow}">
					<Border BorderBrush="#c0111111" BorderThickness="2" CornerRadius="3" >
						<Border Background="#e0080808" BorderBrush="#cccccc" BorderThickness="2" CornerRadius="3" Padding="2">

							<Grid>
								<Grid.RowDefinitions>
									<RowDefinition Height="24"/>
									<RowDefinition Height="*"/>
								</Grid.RowDefinitions>

								<Border Grid.Row="0" BorderBrush="#666" BorderThickness="1" CornerRadius="2" Margin="3">
									<TextBox Name="PART_TextBox" BorderThickness="0" Background="#e3282828" Foreground="#eeeeee"/>
								</Border>

								<Border Grid.Row="1" BorderBrush="#666" BorderThickness="1" CornerRadius="2" Margin="3" Padding="2">
									<ListBox Name="PART_ListBox" ItemsSource="{Binding Path=Items}" ItemContainerStyle="{StaticResource ItemStyle}" ItemTemplate="{StaticResource MachineListItemTemplate}"
													 VirtualizingStackPanel.IsVirtualizing="True" BorderThickness="0" Padding="0,0,8,0">
										<ListBox.Background>
											<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
												<GradientStop Offset="0" Color="#e8080808"/>
												<GradientStop Offset="1" Color="#e8161616"/>
											</LinearGradientBrush>
										</ListBox.Background>
									</ListBox>
								</Border>

							</Grid>
						</Border>
					</Border>

				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
User avatar
strobotone
Posts: 297
Joined: Wed Nov 23, 2011 2:59 pm
Location: berlin
Contact:

Re: Themes - QuickNewMachineWindow : unable to override defa

Post by strobotone »

damn. you´re quick.
awesome, that solved it!
Post Reply