Mąż Zuzanny Harmider Szczęście
Mąż Zuzanny Harmider Szczęście
CC#
Created by Mąż Zuzanny Harmider Szczęście on 1/24/2025 in #help
Issues with wpf binding
u mean for the async stuff?
46 replies
CC#
Created by Mąż Zuzanny Harmider Szczęście on 1/24/2025 in #help
Issues with wpf binding
46 replies
CC#
Created by Mąż Zuzanny Harmider Szczęście on 1/24/2025 in #help
Issues with wpf binding
sure
46 replies
CC#
Created by Mąż Zuzanny Harmider Szczęście on 1/24/2025 in #help
Issues with wpf binding
@FusedQyou
46 replies
CC#
Created by Mąż Zuzanny Harmider Szczęście on 1/24/2025 in #help
Issues with wpf binding
i made Score static for that reason, but now when there's INotifyPropertyChnaged it can no longer be static (at least i think so)
46 replies
CC#
Created by Mąż Zuzanny Harmider Szczęście on 1/24/2025 in #help
Issues with wpf binding
now just one issue, do you have an idea how i could make it so i can give score inside Tile.cs?
46 replies
CC#
Created by Mąż Zuzanny Harmider Szczęście on 1/24/2025 in #help
Issues with wpf binding
I know why it didnt work back then :picard_facepalm: i did {Binding Score} instead of {Binding Path=Score}
46 replies
CC#
Created by Mąż Zuzanny Harmider Szczęście on 1/24/2025 in #help
Issues with wpf binding
btw i tried the INotifyPropertyChanged stuff before but for some reason it just didn't work, but now it does
46 replies
CC#
Created by Mąż Zuzanny Harmider Szczęście on 1/24/2025 in #help
Issues with wpf binding
this is all my code
46 replies
CC#
Created by Mąż Zuzanny Harmider Szczęście on 1/24/2025 in #help
Issues with wpf binding
//MainWindow.xaml
<Window x:Class="TileGame.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:TileGame"
mc:Ignorable="d"
ResizeMode="NoResize"
WindowState="Maximized"
Title="MainWindow" Height="450" Width="800">
<Canvas x:Name="Display">
<Label x:Name="ScoreDisplay" Content="{Binding Path=Score}" Panel.ZIndex="10" Canvas.Top="0" Canvas.Left="960" FontSize="24" FontWeight="Bold"/>
</Canvas>
</Window>
//MainWindow.xaml
<Window x:Class="TileGame.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:TileGame"
mc:Ignorable="d"
ResizeMode="NoResize"
WindowState="Maximized"
Title="MainWindow" Height="450" Width="800">
<Canvas x:Name="Display">
<Label x:Name="ScoreDisplay" Content="{Binding Path=Score}" Panel.ZIndex="10" Canvas.Top="0" Canvas.Left="960" FontSize="24" FontWeight="Bold"/>
</Canvas>
</Window>
46 replies
CC#
Created by Mąż Zuzanny Harmider Szczęście on 1/24/2025 in #help
Issues with wpf binding
46 replies
CC#
Created by Mąż Zuzanny Harmider Szczęście on 1/24/2025 in #help
Issues with wpf binding
;-; i feel overwhelmed
46 replies
CC#
Created by Mąż Zuzanny Harmider Szczęście on 1/24/2025 in #help
Issues with wpf binding
do you have any tutorial to mvvm?
46 replies
CC#
Created by Mąż Zuzanny Harmider Szczęście on 1/24/2025 in #help
Issues with wpf binding
how do i use it?
46 replies
CC#
Created by Mąż Zuzanny Harmider Szczęście on 1/24/2025 in #help
Issues with wpf binding
idk what that is
46 replies
CC#
Created by Mąż Zuzanny Harmider Szczęście on 1/22/2025 in #help
✅ Issues with canvas
i just dont understand what the issue is
4 replies
CC#
Created by Mąż Zuzanny Harmider Szczęście on 1/22/2025 in #help
✅ Issues with canvas
public class InventorySlot : Button
{
public static int Size { get; set; } = 64;
public double X
{
get { return Canvas.GetLeft(this) / Width; }
set { Canvas.SetLeft(this, value * Width); }
}
public double Y
{
get { return Canvas.GetTop(this) / Height; }
set { Canvas.SetTop(this, value * Height); }
}
public InventorySlot()
{
Height = Size;
Width = Size;
}
public InventorySlot(double x, double y) : this()
{
X = x;
Y = y;
Click += Clicked;
}
private void Clicked(object sender, EventArgs e)
{

}
}
public class InventorySlot : Button
{
public static int Size { get; set; } = 64;
public double X
{
get { return Canvas.GetLeft(this) / Width; }
set { Canvas.SetLeft(this, value * Width); }
}
public double Y
{
get { return Canvas.GetTop(this) / Height; }
set { Canvas.SetTop(this, value * Height); }
}
public InventorySlot()
{
Height = Size;
Width = Size;
}
public InventorySlot(double x, double y) : this()
{
X = x;
Y = y;
Click += Clicked;
}
private void Clicked(object sender, EventArgs e)
{

}
}
Inventory slot code
4 replies
CC#
Created by Mąż Zuzanny Harmider Szczęście on 1/22/2025 in #help
✅ Issues with canvas
public class Tile : Image
{
public TileType Type { get;}
public static int Size { get; set; }=32;
public double X {
get { return Canvas.GetLeft(this) / Width; }
set { Canvas.SetLeft(this, value * Width); }
}
public double Y
{
get { return Canvas.GetTop(this) / Height; }
set { Canvas.SetTop(this, value * Height); }
}
public Tile() {
Height = Size;
Width = Size;
Type=TileType.GrassA;
}
public Tile(double x, double y,TileType type) : this()
{
X = x;
Y = y;
Type=type;
ImageBrush brush = new ImageBrush();
brush.ImageSource = new BitmapImage(new Uri(GetImagePath(Type),UriKind.RelativeOrAbsolute));
Source = brush.ImageSource;
MouseLeftButtonDown += TileClicked;
}
public static string GetImagePath(TileType type)
{
switch(type)
{
case TileType.GrassA:
return "tile_0000.png";
case TileType.GrassB:
return "tile_0001.png";
case TileType.GrassC:
return "tile_0002.png";
default:
throw new ArgumentOutOfRangeException(nameof(type), type, null);
}
}
private void TileClicked(object sender, EventArgs e)
{
switch (Type)
{
case TileType.GrassA:
return;
case TileType.GrassB:
return;
case TileType.GrassC:
return;
}
}
}
public class Tile : Image
{
public TileType Type { get;}
public static int Size { get; set; }=32;
public double X {
get { return Canvas.GetLeft(this) / Width; }
set { Canvas.SetLeft(this, value * Width); }
}
public double Y
{
get { return Canvas.GetTop(this) / Height; }
set { Canvas.SetTop(this, value * Height); }
}
public Tile() {
Height = Size;
Width = Size;
Type=TileType.GrassA;
}
public Tile(double x, double y,TileType type) : this()
{
X = x;
Y = y;
Type=type;
ImageBrush brush = new ImageBrush();
brush.ImageSource = new BitmapImage(new Uri(GetImagePath(Type),UriKind.RelativeOrAbsolute));
Source = brush.ImageSource;
MouseLeftButtonDown += TileClicked;
}
public static string GetImagePath(TileType type)
{
switch(type)
{
case TileType.GrassA:
return "tile_0000.png";
case TileType.GrassB:
return "tile_0001.png";
case TileType.GrassC:
return "tile_0002.png";
default:
throw new ArgumentOutOfRangeException(nameof(type), type, null);
}
}
private void TileClicked(object sender, EventArgs e)
{
switch (Type)
{
case TileType.GrassA:
return;
case TileType.GrassB:
return;
case TileType.GrassC:
return;
}
}
}
Tile code
4 replies
CC#
Created by Mąż Zuzanny Harmider Szczęście on 1/21/2025 in #help
✅ Issues with window resizing
$solved
7 replies
CC#
Created by Mąż Zuzanny Harmider Szczęście on 1/21/2025 in #help
✅ Issues with window resizing
!solved
7 replies