Jump to content
UBot Underground

Gui Tutorial And Template Using Xaml And Datagrid


Recommended Posts

Hey everyone this is the free XAML template I have told some of you about. There are also 5 themes that come with it. I also show you in the video how you can easily change the colors and how to use it to build your own GUI with it. If you need a fully customized template or GUI for your next big project feel free to shoot me a message. You need Aymen's XAML plugin for this, and if you want the datagrid that plugin as well.

 

 

Download Link

  • Like 11
Link to post
Share on other sites

Thank you. Do u know if those plugins are still being supported?

 

Not really actively developed but there is enough there to do a lot with them. And for some things that are not typically supported I've found workarounds for.

Link to post
Share on other sites

Nice tutorial. Will come in handy in the future when i get the plugin but aymen looks like abandoned it.

Abbas told me that he have a xaml plugin with more features but not sure if he ever going to sell it to public.

 

I hope he does. I am working on my own alternative to take the GUI out of Ubot completely but I can't say for sure if I'll finish it yet because while it would fuse the best worlds of C# and Ubot together it's a good amount of integration required and so I don't know how useful it would be to anybody else..

Link to post
Share on other sites

I hope he does. I am working on my own alternative to take the GUI out of Ubot completely but I can't say for sure if I'll finish it yet because while it would fuse the best worlds of C# and Ubot together it's a good amount of integration required and so I don't know how useful it would be to anybody else..

 

That would be great if you can come up with that. A tutorial on creating GUI on C# and properly connect them to ubot codes

Link to post
Share on other sites

That would be great if you can come up with that. A tutorial on creating GUI on C# and properly connect them to ubot codes

 

 

I would have to finish my plugin which connects them and then the way they would be integrated would mean some C# code but I can write classes and stuff for it of course to make it easier.

 

The real advantage is that the GUI would be a C# program and so you can do things like use value converters for example which opens a whole new world of possibilities. And the data could become actual objects and so again more cool stuff you can do on a GUI with that kind of thing.

Link to post
Share on other sites

That would be cool. I will be the one who purchase it when that product came out.

I've lost lot of sales because uihtml cant handle html with lots of forms and codes that will make the interface very slow to navigate especially on laptops.

  • Like 1
Link to post
Share on other sites
  • 4 months later...

Thanks for this. Playing around with Blend now trying to get the hang of it. Found the event trigger for a button click, but trying to bind it to an open file dialog. Any pointers on that one?

Link to post
Share on other sites

Thanks for this. Playing around with Blend now trying to get the hang of it. Found the event trigger for a button click, but trying to bind it to an open file dialog. Any pointers on that one?

 

To bind to an open file dialog you can do it with the file management plugin like this:

plugin command("XAMLUI.dll", "Xaml event hook", "your control here", "Click", "OpenFile")
define OpenFile {
    set(#file,$plugin function("File Management.dll", "$open file dialog"),"Global")
}
  • Like 2
Link to post
Share on other sites
  • 4 weeks later...

Thank you for sharing this, looks like a fantastic resource! Will be downloading and digging into it this weekend.

 

Quick question: I've been using the XAML UI for a while now with just some default styling, and I use the "add datagrid to xaml ui" function to put a grid in the middle of the UI. All of my bots I've built so far are not responsive (fixed height and width), but I decided to start experimenting to get them that way. I've started using DockPanels to dock elements and letting the last child fill the rest of the space.

 

It works great, except that if the height I set in the Load XAML UI command is fixed, so when users click maximize the bot goes full screen and stretches across properly, but it doesn't fill out the bottom of the screen (it stays the same height as what's set in the Height setting).

 

Does your template cover how to get it fully responsive (without having to have the grid in the "default" ubot browser area), or do you have any idea how I can incorporate that into your template - or with general XAML in Ubot?

 

Thanks again!

Link to post
Share on other sites

Thank you for sharing this, looks like a fantastic resource! Will be downloading and digging into it this weekend.

 

Quick question: I've been using the XAML UI for a while now with just some default styling, and I use the "add datagrid to xaml ui" function to put a grid in the middle of the UI. All of my bots I've built so far are not responsive (fixed height and width), but I decided to start experimenting to get them that way. I've started using DockPanels to dock elements and letting the last child fill the rest of the space.

 

It works great, except that if the height I set in the Load XAML UI command is fixed, so when users click maximize the bot goes full screen and stretches across properly, but it doesn't fill out the bottom of the screen (it stays the same height as what's set in the Height setting).

 

Does your template cover how to get it fully responsive (without having to have the grid in the "default" ubot browser area), or do you have any idea how I can incorporate that into your template - or with general XAML in Ubot?

 

Thanks again!

 

You should be able to add the main grid into a dockpanel and pull out thee datagrid and add it after the main grid, here is a quick example:

<UserControl.Resources>
	<Style TargetType="{x:Type UserControl}">
		<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor, 
AncestorType={x:Type Window}},Path=ActualHeight}"/>
	</Style>
</UserControl.Resources>

<Border Padding="8">
	<Border.Resources>
	<Color x:Key="backgroundLight">#9CBDE4</Color>
		<SolidColorBrush x:Key="backgroundLightBrush" Color="{StaticResource backgroundLight}"/>
		<Color x:Key="backgroundDark">#3298D2</Color>
		<SolidColorBrush x:Key="backgroundDarkBrush" Color="{StaticResource backgroundDark}"/>
		<Color x:Key="foreground">#242B43</Color>
		<SolidColorBrush x:Key="foregroundBrush" Color="{StaticResource foreground}"/>
		<Color x:Key="foregroundLight">#FEFEFE</Color>
		<SolidColorBrush x:Key="foregroundLightBrush" Color="{StaticResource foregroundLight}"/>
		<Color x:Key="foregroundLightHover">#FCD20A</Color>
		<SolidColorBrush x:Key="foregroundLightHoverBrush" Color="{StaticResource foregroundLightHover}"/>
		
		<Style x:Key="headerTextBlock" TargetType="{x:Type TextBlock}">
			<Setter Property="Foreground" Value="{StaticResource foregroundBrush}"/>
			<Setter Property="FontFamily" Value="Arial Narrow"/>
			<Setter Property="VerticalAlignment" Value="Center"/>
			<Setter Property="FontSize" Value="24"/>
			<Setter Property="FontWeight" Value="Bold"/>
			<Setter Property="Margin" Value="8 0 0 0"/>
		</Style>

		<Style x:Key="normalTextBlock" TargetType="{x:Type TextBlock}">
			<Setter Property="Foreground" Value="{StaticResource foregroundBrush}"/>
			<Setter Property="FontFamily" Value="Arial"/>
			<Setter Property="FontSize" Value="16"/>
		</Style>

		<Style x:Key="formTextBox" TargetType="{x:Type TextBox}">
			<Setter Property="Background" Value="{StaticResource foregroundLightBrush}"/>
			<Setter Property="Padding" Value="4"/>
			<Setter Property="VerticalContentAlignment" Value="Center"/>
			<Setter Property="BorderThickness" Value="1"/>
			<Setter Property="FontFamily" Value="Arial"/>
			<Setter Property="FontSize" Value="14"/>
			<Setter Property="BorderBrush" Value="{StaticResource foregroundBrush}"/>
			<Setter Property="Margin" Value="0 2 0 0"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type TextBox}">
						<Border Name="borderContainer" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="4">
							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup x:Name="CommonStates">
									<VisualState x:Name="Normal"/>
									<VisualState x:Name="Disabled"/>
									<VisualState x:Name="ReadOnly"/>
									<VisualState x:Name="MouseOver">
										<Storyboard>
											<ColorAnimation Duration="0" Storyboard.TargetName="borderContainer" 
																	Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="{StaticResource foregroundLightHover}"/>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
								<VisualStateGroup x:Name="FocusStates">
									<VisualState x:Name="Unfocused"/>
									<VisualState x:Name="Focused">
										<Storyboard>
											<ColorAnimation Duration="0" Storyboard.TargetName="borderContainer" 
																	Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="{StaticResource foregroundLightHover}"/>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
							</VisualStateManager.VisualStateGroups>
							<Grid Margin="{TemplateBinding Padding}">

								<ScrollViewer Margin="0" x:Name="PART_ContentHost"/>
							</Grid>
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>

		<Style TargetType="{x:Type Button}">
			<Setter Property="Background" Value="{StaticResource foregroundBrush}"/>
			<Setter Property="Foreground" Value="{StaticResource foregroundLightHoverBrush}"/>
			<Setter Property="Padding" Value="26 14"/>
			<Setter Property="FontFamily" Value="Arial"/>
			<Setter Property="FontSize" Value="16"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type Button}">
						<Border Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" CornerRadius="14">
							<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>

		<Style x:Key="formComboBox" TargetType="{x:Type ComboBox}">
			<Setter Property="Background" Value="{StaticResource foregroundLightBrush}"/>
			<Setter Property="BorderBrush" Value="{StaticResource foregroundBrush}"/>
			<Setter Property="FontFamily" Value="Arial"/>
			<Setter Property="FontSize" Value="14"/>
			<Setter Property="Padding" Value="6"/>
		</Style>

		<Style x:Key="formCheckbox" TargetType="{x:Type CheckBox}">
			<Setter Property="Background" Value="{StaticResource foregroundLightBrush}"/>
			<Setter Property="Foreground" Value="{StaticResource foregroundBrush}"/>
			<Setter Property="FontFamily" Value="Arial"/>
			<Setter Property="FontSize" Value="16"/>
			<Setter Property="VerticalContentAlignment" Value="Center"/>
		</Style>

		<Style TargetType="{x:Type DataGridColumnHeader}">
			<Setter Property="VerticalContentAlignment" Value="Center"/>
			<Setter Property="HorizontalContentAlignment" Value="Center"/>
			<Setter Property="Padding" Value="10 10"/>
			<Setter Property="FontFamily" Value="Arial"/>
			<Setter Property="FontSize" Value="14"/>
			<Setter Property="FontWeight" Value="Bold"/>
			<Setter Property="Foreground" Value="{StaticResource foregroundLightBrush}"/>
			<Setter Property="Background" Value="{StaticResource foregroundBrush}"/>
			<Setter Property="BorderBrush" Value="{StaticResource foregroundLightHoverBrush}"/>
			<Setter Property="BorderThickness" Value="1"/>
		</Style>

		<Style TargetType="{x:Type DataGridRowHeader}">
			<Setter Property="Template" Value="{x:Null}"/>
		</Style>
	</Border.Resources>
	
	
	<DockPanel LastChildFill="True">
                
            
            <Grid DockPanel.Dock="Top">
		<Grid.ColumnDefinitions>
			<ColumnDefinition/>
			<ColumnDefinition Width="10"/>
			<ColumnDefinition/>
		</Grid.ColumnDefinitions>
		<Grid.RowDefinitions>
			<RowDefinition Height="32"/>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="Auto"/>
		</Grid.RowDefinitions>

		<TextBlock Text="Create Project" Style="{StaticResource headerTextBlock}" Grid.Row="0" Grid.Column="0"/>

		<StackPanel Grid.Column="0" Grid.Row="1">
			<DockPanel LastChildFill="True">
				<TextBlock Text="Name" Style="{StaticResource normalTextBlock}" DockPanel.Dock="Top" VerticalAlignment="Center" Margin="0 0 4 0"/>
				<TextBox x:Name="nameTextBox"  Style="{StaticResource formTextBox}"/>
			</DockPanel>
			<Separator Height="6" Background="{x:Null}"/>
			<DockPanel LastChildFill="True">
				<TextBlock Text="Website" Style="{StaticResource normalTextBlock}" DockPanel.Dock="Top" VerticalAlignment="Center" Margin="0 0 4 0"/>
				<TextBox x:Name="websiteTextBox" Style="{StaticResource formTextBox}"/>
			</DockPanel>
			<Separator Height="6" Background="{x:Null}"/>
			<DockPanel LastChildFill="True">
				<TextBlock Text="Country" Style="{StaticResource normalTextBlock}" DockPanel.Dock="Top" VerticalAlignment="Center" Margin="0 0 4 0"/>
				<ComboBox x:Name="countryComboBox" Style="{StaticResource formComboBox}"/>
			</DockPanel>
		</StackPanel>

		<StackPanel Grid.Column="3" Grid.Row="1">
			<DockPanel LastChildFill="True">
				<TextBlock Text="Phone Number" Style="{StaticResource normalTextBlock}" DockPanel.Dock="Top" VerticalAlignment="Center" Margin="0 0 4 0"/>
				<TextBox x:Name="phoneTextBox" Style="{StaticResource formTextBox}"/>
			</DockPanel>
			<Separator Height="6" Background="{x:Null}"/>
			<DockPanel LastChildFill="True">
				<TextBlock Text="Email" Style="{StaticResource normalTextBlock}" DockPanel.Dock="Top" VerticalAlignment="Center" Margin="0 0 4 0"/>
				<TextBox x:Name="emailTextBox" Style="{StaticResource formTextBox}"/>
			</DockPanel>
			<Separator Height="6" Background="{x:Null}"/>
			<Grid>
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="96"/>
					<ColumnDefinition/>
				</Grid.ColumnDefinitions>
				<CheckBox x:Name="activeCheckBox" Style="{StaticResource formCheckbox}" VerticalAlignment="Center" Content="Active" Padding="6 0 0 0" Grid.Column="1"/>
				<Button x:Name="addButton" Content="Add" Grid.Column="0" HorizontalAlignment="left"/>
			</Grid>

		</StackPanel>

		
	</Grid>
	
	<Grid Name="dataGrid" Margin="0 10 0 10"/>
	</DockPanel>
	<Border.Background>
		<RadialGradientBrush>
			<GradientStop Color="{StaticResource backgroundDark}" Offset="1"/>
			<GradientStop Color="{StaticResource backgroundLight}"/>
		</RadialGradientBrush>
	</Border.Background>
</Border>
  • Like 1
Link to post
Share on other sites
  • 2 weeks later...

 

You should be able to add the main grid into a dockpanel and pull out thee datagrid and add it after the main grid, here is a quick example:

<UserControl.Resources>
	<Style TargetType="{x:Type UserControl}">
		<Setter Property="Height" Value="{Binding RelativeSource={RelativeSource FindAncestor, 
AncestorType={x:Type Window}},Path=ActualHeight}"/>
	</Style>
</UserControl.Resources>

<Border Padding="8">
	<Border.Resources>
	<Color x:Key="backgroundLight">#9CBDE4</Color>
		<SolidColorBrush x:Key="backgroundLightBrush" Color="{StaticResource backgroundLight}"/>
		<Color x:Key="backgroundDark">#3298D2</Color>
		<SolidColorBrush x:Key="backgroundDarkBrush" Color="{StaticResource backgroundDark}"/>
		<Color x:Key="foreground">#242B43</Color>
		<SolidColorBrush x:Key="foregroundBrush" Color="{StaticResource foreground}"/>
		<Color x:Key="foregroundLight">#FEFEFE</Color>
		<SolidColorBrush x:Key="foregroundLightBrush" Color="{StaticResource foregroundLight}"/>
		<Color x:Key="foregroundLightHover">#FCD20A</Color>
		<SolidColorBrush x:Key="foregroundLightHoverBrush" Color="{StaticResource foregroundLightHover}"/>
		
		<Style x:Key="headerTextBlock" TargetType="{x:Type TextBlock}">
			<Setter Property="Foreground" Value="{StaticResource foregroundBrush}"/>
			<Setter Property="FontFamily" Value="Arial Narrow"/>
			<Setter Property="VerticalAlignment" Value="Center"/>
			<Setter Property="FontSize" Value="24"/>
			<Setter Property="FontWeight" Value="Bold"/>
			<Setter Property="Margin" Value="8 0 0 0"/>
		</Style>

		<Style x:Key="normalTextBlock" TargetType="{x:Type TextBlock}">
			<Setter Property="Foreground" Value="{StaticResource foregroundBrush}"/>
			<Setter Property="FontFamily" Value="Arial"/>
			<Setter Property="FontSize" Value="16"/>
		</Style>

		<Style x:Key="formTextBox" TargetType="{x:Type TextBox}">
			<Setter Property="Background" Value="{StaticResource foregroundLightBrush}"/>
			<Setter Property="Padding" Value="4"/>
			<Setter Property="VerticalContentAlignment" Value="Center"/>
			<Setter Property="BorderThickness" Value="1"/>
			<Setter Property="FontFamily" Value="Arial"/>
			<Setter Property="FontSize" Value="14"/>
			<Setter Property="BorderBrush" Value="{StaticResource foregroundBrush}"/>
			<Setter Property="Margin" Value="0 2 0 0"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type TextBox}">
						<Border Name="borderContainer" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="4">
							<VisualStateManager.VisualStateGroups>
								<VisualStateGroup x:Name="CommonStates">
									<VisualState x:Name="Normal"/>
									<VisualState x:Name="Disabled"/>
									<VisualState x:Name="ReadOnly"/>
									<VisualState x:Name="MouseOver">
										<Storyboard>
											<ColorAnimation Duration="0" Storyboard.TargetName="borderContainer" 
																	Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="{StaticResource foregroundLightHover}"/>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
								<VisualStateGroup x:Name="FocusStates">
									<VisualState x:Name="Unfocused"/>
									<VisualState x:Name="Focused">
										<Storyboard>
											<ColorAnimation Duration="0" Storyboard.TargetName="borderContainer" 
																	Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="{StaticResource foregroundLightHover}"/>
										</Storyboard>
									</VisualState>
								</VisualStateGroup>
							</VisualStateManager.VisualStateGroups>
							<Grid Margin="{TemplateBinding Padding}">

								<ScrollViewer Margin="0" x:Name="PART_ContentHost"/>
							</Grid>
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>

		<Style TargetType="{x:Type Button}">
			<Setter Property="Background" Value="{StaticResource foregroundBrush}"/>
			<Setter Property="Foreground" Value="{StaticResource foregroundLightHoverBrush}"/>
			<Setter Property="Padding" Value="26 14"/>
			<Setter Property="FontFamily" Value="Arial"/>
			<Setter Property="FontSize" Value="16"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type Button}">
						<Border Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" CornerRadius="14">
							<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>

		<Style x:Key="formComboBox" TargetType="{x:Type ComboBox}">
			<Setter Property="Background" Value="{StaticResource foregroundLightBrush}"/>
			<Setter Property="BorderBrush" Value="{StaticResource foregroundBrush}"/>
			<Setter Property="FontFamily" Value="Arial"/>
			<Setter Property="FontSize" Value="14"/>
			<Setter Property="Padding" Value="6"/>
		</Style>

		<Style x:Key="formCheckbox" TargetType="{x:Type CheckBox}">
			<Setter Property="Background" Value="{StaticResource foregroundLightBrush}"/>
			<Setter Property="Foreground" Value="{StaticResource foregroundBrush}"/>
			<Setter Property="FontFamily" Value="Arial"/>
			<Setter Property="FontSize" Value="16"/>
			<Setter Property="VerticalContentAlignment" Value="Center"/>
		</Style>

		<Style TargetType="{x:Type DataGridColumnHeader}">
			<Setter Property="VerticalContentAlignment" Value="Center"/>
			<Setter Property="HorizontalContentAlignment" Value="Center"/>
			<Setter Property="Padding" Value="10 10"/>
			<Setter Property="FontFamily" Value="Arial"/>
			<Setter Property="FontSize" Value="14"/>
			<Setter Property="FontWeight" Value="Bold"/>
			<Setter Property="Foreground" Value="{StaticResource foregroundLightBrush}"/>
			<Setter Property="Background" Value="{StaticResource foregroundBrush}"/>
			<Setter Property="BorderBrush" Value="{StaticResource foregroundLightHoverBrush}"/>
			<Setter Property="BorderThickness" Value="1"/>
		</Style>

		<Style TargetType="{x:Type DataGridRowHeader}">
			<Setter Property="Template" Value="{x:Null}"/>
		</Style>
	</Border.Resources>
	
	
	<DockPanel LastChildFill="True">
                
            
            <Grid DockPanel.Dock="Top">
		<Grid.ColumnDefinitions>
			<ColumnDefinition/>
			<ColumnDefinition Width="10"/>
			<ColumnDefinition/>
		</Grid.ColumnDefinitions>
		<Grid.RowDefinitions>
			<RowDefinition Height="32"/>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="Auto"/>
		</Grid.RowDefinitions>

		<TextBlock Text="Create Project" Style="{StaticResource headerTextBlock}" Grid.Row="0" Grid.Column="0"/>

		<StackPanel Grid.Column="0" Grid.Row="1">
			<DockPanel LastChildFill="True">
				<TextBlock Text="Name" Style="{StaticResource normalTextBlock}" DockPanel.Dock="Top" VerticalAlignment="Center" Margin="0 0 4 0"/>
				<TextBox x:Name="nameTextBox"  Style="{StaticResource formTextBox}"/>
			</DockPanel>
			<Separator Height="6" Background="{x:Null}"/>
			<DockPanel LastChildFill="True">
				<TextBlock Text="Website" Style="{StaticResource normalTextBlock}" DockPanel.Dock="Top" VerticalAlignment="Center" Margin="0 0 4 0"/>
				<TextBox x:Name="websiteTextBox" Style="{StaticResource formTextBox}"/>
			</DockPanel>
			<Separator Height="6" Background="{x:Null}"/>
			<DockPanel LastChildFill="True">
				<TextBlock Text="Country" Style="{StaticResource normalTextBlock}" DockPanel.Dock="Top" VerticalAlignment="Center" Margin="0 0 4 0"/>
				<ComboBox x:Name="countryComboBox" Style="{StaticResource formComboBox}"/>
			</DockPanel>
		</StackPanel>

		<StackPanel Grid.Column="3" Grid.Row="1">
			<DockPanel LastChildFill="True">
				<TextBlock Text="Phone Number" Style="{StaticResource normalTextBlock}" DockPanel.Dock="Top" VerticalAlignment="Center" Margin="0 0 4 0"/>
				<TextBox x:Name="phoneTextBox" Style="{StaticResource formTextBox}"/>
			</DockPanel>
			<Separator Height="6" Background="{x:Null}"/>
			<DockPanel LastChildFill="True">
				<TextBlock Text="Email" Style="{StaticResource normalTextBlock}" DockPanel.Dock="Top" VerticalAlignment="Center" Margin="0 0 4 0"/>
				<TextBox x:Name="emailTextBox" Style="{StaticResource formTextBox}"/>
			</DockPanel>
			<Separator Height="6" Background="{x:Null}"/>
			<Grid>
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="96"/>
					<ColumnDefinition/>
				</Grid.ColumnDefinitions>
				<CheckBox x:Name="activeCheckBox" Style="{StaticResource formCheckbox}" VerticalAlignment="Center" Content="Active" Padding="6 0 0 0" Grid.Column="1"/>
				<Button x:Name="addButton" Content="Add" Grid.Column="0" HorizontalAlignment="left"/>
			</Grid>

		</StackPanel>

		
	</Grid>
	
	<Grid Name="dataGrid" Margin="0 10 0 10"/>
	</DockPanel>
	<Border.Background>
		<RadialGradientBrush>
			<GradientStop Color="{StaticResource backgroundDark}" Offset="1"/>
			<GradientStop Color="{StaticResource backgroundLight}"/>
		</RadialGradientBrush>
	</Border.Background>
</Border>

 

 

Still messing with this, thank you for pointing  me in the right direction - very helpful & much appreciated!

Edited by drewness
  • Like 1
Link to post
Share on other sites
  • 2 months later...
  • 2 weeks later...

I am trying to remove the extra space from the right and bottom edges of datagrid rows as u see im image,

if i try to apply

<Style TargetType="{x:Type DataGridRow}">
            <Setter Property="Template" Value="{x:Null}"/>

 

to the datagrid rows, all the cell content disappears, so i am not able to use that.

 

However the same code used on the datagrid row header removes that space but inside the datagrid row its not working

 

So how to get rid of that space

post-16700-0-57315500-1520349344_thumb.png

Link to post
Share on other sites

Also any suggestion how to get alternating row colour to be different like the attached image. I tried both the alternate row index and alternate row cell property but they didn't work .

post-16700-0-08103800-1520396977_thumb.png

Link to post
Share on other sites

it works with the following code inside of datagrid style but any style to datagrid row takes the priority, so the colour does not show

 

<Style TargetType="{x:Type DataGrid}">

 

      <Setter Property="AlternatingRowBackground" Value="LightGray"/>
                                        <Setter Property="AlternationCount" Value="2" />

Link to post
Share on other sites
  • 2 weeks later...

Hey HelloInsomnia,

Firstly just wanted to point out that the code for making a bots UI dynamic is priceless, i had actually stopped using the xaml plugin because of it, but now with your littel snippet of code at the top all is groovy :)

 

Anywho, ill get to the point, ... 

 

I know the data grid and xaml plugins are not yours but you seem to have your head into the little tricks that can make the difference so i figured i would throw you a quick question or two.

 

Q1)

Is there a way to make the data grid rows selectable but NOT editable ?

 

Q2)

Is there a way to get the Context menu working on the datagrid when using an xaml UI ?

 

 

No worries if you havent any pearls of wisdom on these, no doubt ill pop over and fire the same questions to Aymen.

 

 

 

 

Cheers

CJ

Link to post
Share on other sites
  • 2 weeks later...

Hey HelloInsomnia,

Firstly just wanted to point out that the code for making a bots UI dynamic is priceless, i had actually stopped using the xaml plugin because of it, but now with your littel snippet of code at the top all is groovy :)

 

Anywho, ill get to the point, ... 

 

I know the data grid and xaml plugins are not yours but you seem to have your head into the little tricks that can make the difference so i figured i would throw you a quick question or two.

 

Q1)

Is there a way to make the data grid rows selectable but NOT editable ?

 

Q2)

Is there a way to get the Context menu working on the datagrid when using an xaml UI ?

 

 

No worries if you havent any pearls of wisdom on these, no doubt ill pop over and fire the same questions to Aymen.

 

 

 

 

Cheers

CJ

 

Here is how you can make it readonly so they can't edit the cells

plugin command("XAMLUI.dll", "Load Xaml UI", "<StackPanel>
            <StackPanel.Resources>
                <Style TargetType=\"\{x:Type DataGrid\}\">
                    <Setter Property=\"IsReadOnly\" Value=\"True\"/>
                </Style>
            </StackPanel.Resources>
            <Slider Foreground=\"Beige\" Minimum=\"0\" Maximum=\"100\" TickFrequency=\"5\" Ticks=\"20\"/>
            <Grid x:Name=\"dg\"/>
        </StackPanel>", "", "", "Basic")
plugin command("DataGridUI.dll", "add datagrid to xaml ui", "1|2|3", "dg")
plugin command("DataGridUI.dll", "add datagrid row", "one|two|three")

For the second question I'd have to take a deeper look at it one day to see what exactly is going on.

 

Oh and you don't need the slider in the code there it was just in my scratchpad already and I left it in.

  • Like 2
Link to post
Share on other sites

Here is how you can make it readonly so they can't edit the cells

plugin command("XAMLUI.dll", "Load Xaml UI", "<StackPanel>
            <StackPanel.Resources>
                <Style TargetType=\"\{x:Type DataGrid\}\">
                    <Setter Property=\"IsReadOnly\" Value=\"True\"/>
                </Style>
            </StackPanel.Resources>
            <Slider Foreground=\"Beige\" Minimum=\"0\" Maximum=\"100\" TickFrequency=\"5\" Ticks=\"20\"/>
            <Grid x:Name=\"dg\"/>
        </StackPanel>", "", "", "Basic")
plugin command("DataGridUI.dll", "add datagrid to xaml ui", "1|2|3", "dg")
plugin command("DataGridUI.dll", "add datagrid row", "one|two|three")

For the second question I'd have to take a deeper look at it one day to see what exactly is going on.

 

Oh and you don't need the slider in the code there it was just in my scratchpad already and I left it in.

 

 

Hey,

 

You are a saint man! .. thank you for that, very much appreciated.

 

I can live with the lack of context menu, nothing that cant be done with buttons, thanks for the help.

 

 

 

Cheers

CJ

Link to post
Share on other sites

Hi,

Same here the free xaml code nick shared is priceless.

 

1. You cannot use datagrid context to work, but a workaround would be a button to use and run a custom define

 

2. Also individual rows don't get deleted in datagrid xaml UI, I tried to delete but never worked! did it work for u when  u run a custom define to delete a row


Hey HelloInsomnia,

Firstly just wanted to point out that the code for making a bots UI dynamic is priceless, i had actually stopped using the xaml plugin because of it, but now with your littel snippet of code at the top all is groovy :)

 

Anywho, ill get to the point, ... 

 

I know the data grid and xaml plugins are not yours but you seem to have your head into the little tricks that can make the difference so i figured i would throw you a quick question or two.

 

Q1)

Is there a way to make the data grid rows selectable but NOT editable ?

 

Q2)

Is there a way to get the Context menu working on the datagrid when using an xaml UI ?

 

 

No worries if you havent any pearls of wisdom on these, no doubt ill pop over and fire the same questions to Aymen.

 

 

 

 

Cheers

CJ

 

Hi,

Same here the free xaml code nick shared is priceless.

 

1. You cannot use datagrid context to work, but a workaround would be a button to use and run a custom define

 

2. Also individual rows don't get deleted in datagrid xaml UI, I tried to delete but never worked! did it work for u when  u run a custom define to delete a row

Link to post
Share on other sites

Hi,

Same here the free xaml code nick shared is priceless.

 

1. You cannot use datagrid context to work, but a workaround would be a button to use and run a custom define

 

2. Also individual rows don't get deleted in datagrid xaml UI, I tried to delete but never worked! did it work for u when  u run a custom define to delete a row

 

Hey, 

Thats a damn shame if we cant, not the end of the world but still a litte dissappointing :/

 

In regards to some datagrid commands not working from a define, .. This one can get tricky, 

 

I found that "some" of the data grid commands will simply not work from a define, ...... unless the define is run from hitting the Start button in uBot.

Sounds funky i know, however i have tested this extensively, ill explain ... 

 

I first noticed this happen when i was coding some simple datagrid control buttons and after some tests found that a few other commands behaved the same way,

It was very weird, I even placed alerts before and after just to see if I had done something wrong and the alerts would fire but the datagrid commands between were ignored.

This also happens to me using the advanced dialoge plugin.

 

So the way that i had to work around this was :

- Create a define that contains 1 Variable and the "main button click" command

- Use the Var to state what process you are about to start

- Place a "If" at the very top of my main project tab (eg. If Var = Delete)

- Then have the define/commands that will actually do the process 

- And an "end script" immediately after that define you want to run 

 

Then when a button is clicked it will set the Var and fire UBot process, hit your IF code and run the define/commands without any problems

 

 

lol, sorry, I may have made that sounds a bit more complicated that it is

 

 

 

 

Cheers

CJ

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...