Page 1 of 1

Themes - QuickNewMachineWindow : unable to override defaults

Posted: Wed Feb 01, 2012 2:20 pm
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 !

Re: Themes - QuickNewMachineWindow : unable to override defa

Posted: Wed Feb 01, 2012 2:44 pm
by oskari
I'll have to update it to load the resource dictionary.

Re: Themes - QuickNewMachineWindow : unable to override defa

Posted: Wed Feb 01, 2012 3:26 pm
by oskari
QuickNewMachineWindow, CreateTemplateWindow, LatencyWindow, CPUMonitorWindow and HDRecorderWindow should now support MachineView.xaml resources.

Re: Themes - QuickNewMachineWindow : unable to override defa

Posted: Wed Feb 01, 2012 3:34 pm
by strobotone
oops. many thanks Oskari !
Works now.

Re: Themes - QuickNewMachineWindow : unable to override defa

Posted: Thu Feb 02, 2012 4:58 pm
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>

Re: Themes - QuickNewMachineWindow : unable to override defa

Posted: Thu Feb 02, 2012 6:10 pm
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.

Re: Themes - QuickNewMachineWindow : unable to override defa

Posted: Thu Feb 02, 2012 7:31 pm
by oskari
It should work in 1442. The names and the way double-click is handled have changed a bit.

Re: Themes - QuickNewMachineWindow : unable to override defa

Posted: Thu Feb 02, 2012 7:34 pm
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.

Re: Themes - QuickNewMachineWindow : unable to override defa

Posted: Thu Feb 02, 2012 8:37 pm
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>

Re: Themes - QuickNewMachineWindow : unable to override defa

Posted: Thu Feb 02, 2012 8:42 pm
by strobotone
damn. you´re quick.
awesome, that solved it!