Notifications
Clear all

[Closed] A few dotnet list view question

 MZ1

Here is another example:

global Window
(
	if heapSize < 256000000 do heapSize = 256000000 --256Mb
	
	-- Window
	if Window != undefined do Window.close()
	
	XamlString = 
	"
	<Window
		xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"
		xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"
		Title=\"MainWindow\" Height=\"350\" Width=\"525\">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width=\"*\" />
            <ColumnDefinition Width=\"5\" />
            <ColumnDefinition Width=\"*\" />
        </Grid.ColumnDefinitions>
        <TreeView>
            <TreeViewItem Header=\"Root\" IsExpanded=\"True\" Padding=\"5\">
                <Button Content=\"Trigger Red\" Name=\"TheTriggerRed\" Padding=\"5\" Margin=\"5\"/>
                <Button Content=\"Trigger Green\" Name=\"TheTriggerGreen\" Padding=\"5\" Margin=\"5\"/>
                <Button Content=\"Trigger Blue\" Name=\"TheTriggerBlue\" Padding=\"5\" Margin=\"5\"/>
            </TreeViewItem>
        </TreeView>
        <GridSplitter Grid.Column=\"1\" Width=\"5\" HorizontalAlignment=\"Stretch\"/>
        <StackPanel Grid.Column=\"2\">
            <Expander Padding=\"5\" IsExpanded=\"True\" Background=\"Red\" Visibility=\"Collapsed\" Name=\"TheExpanderRed\">
                <Button Content=\"****\"/>
            </Expander>
            <Expander Padding=\"5\" IsExpanded=\"True\" Background=\"Green\" Visibility=\"Collapsed\" Name=\"TheExpanderGreen\">
                <Slider/>
            </Expander>
            <Expander Padding=\"5\" IsExpanded=\"True\" Background=\"Blue\" Visibility=\"Collapsed\" Name=\"TheExpanderBlue\">
                <Button Content=\"####\"/>
            </Expander>
        </StackPanel>
    </Grid>
	</Window>
	"
	Window = (dotnetclass "System.Windows.Markup.XamlReader").Parse XamlString
	TheTriggerRed = Window.findname "TheTriggerRed"
	TheTriggerGreen = Window.findname "TheTriggerGreen"
	TheTriggerBlue = Window.findname "TheTriggerBlue"
	TheExpanderRed = Window.findname "TheExpanderRed"
	TheExpanderGreen = Window.findname "TheExpanderGreen"
	TheExpanderBlue = Window.findname "TheExpanderBlue"
	
	fn SetExpanderVisibility Nam =
	(
		case Nam of
		(
			"TheTriggerRed":
			(
				TheExpanderRed.Visibility = TheExpanderRed.Visibility.Visible
				TheExpanderGreen.Visibility = TheExpanderRed.Visibility.Collapsed
				TheExpanderBlue.Visibility = TheExpanderRed.Visibility.Collapsed
			)
			"TheTriggerGreen":
			(
				TheExpanderRed.Visibility = TheExpanderRed.Visibility.Collapsed
				TheExpanderGreen.Visibility = TheExpanderRed.Visibility.Visible
				TheExpanderBlue.Visibility = TheExpanderRed.Visibility.Collapsed
			)
			"TheTriggerBlue":
			(
				TheExpanderRed.Visibility = TheExpanderRed.Visibility.Collapsed
				TheExpanderGreen.Visibility = TheExpanderRed.Visibility.Collapsed
				TheExpanderBlue.Visibility = TheExpanderRed.Visibility.Visible
			)
		)
	)
	
	fn OnClick Sender Arg =
	(
		SetExpanderVisibility Sender.name
	)
	for b in #(TheTriggerRed,TheTriggerGreen,TheTriggerBlue) do
	(
		dotNet.AddEventHandler b #Click OnClick
		dotNet.SetLifeTimeControl b #dotNet
	)
	
	-- Show Window
	(dotnetobject "System.Windows.Interop.WindowInteropHelper" Window).owner = dotnetobject "IntPtr" (windows.getMAXHWND())
	(dotnetclass "ManagedServices.AppSDK").ConfigureWindowForMax Window
	Window.show()
)

Thanks.

I guess I need to try to convett a subrollout as a WPF form and putin elementhost…

 MZ1

You can’t embed 3dsMax’s controls inside WPF.

Page 2 / 2