@xyzzy
@xyzzy
Forum Replies Created
-
AuthorPosts
-
xyzzyMember
Any code examples to show how this is done?
I tried adding a class and id to the object and defining a font-size before creating this post without any joy. [Class is an undocumented property in your API documentation]
<ComboBox Class=”vcs-combo” Id=”idIlluminant” …
and in style.css
.vcs-combo {
font-size: smaller;
}
#idIlluminant {
font-size: xx-small;
}
ComboBox {
font-size: x-small;
}
No joy with any of them.
xyzzyMemberYes I have.
xyzzyMemberOk, after trying d2, n2, x2, x.xxxx the format is “0.0000”
You really need to spend sometime on the documentation as
“Sets or gets the column’s cells format.”
Needs replacing with a list of the string format options.xyzzyMemberPeter,
Thanks for all your efforts resolving this, especially as this was all done over the weekend.
<template id=”colourTemplate”>
<div style=”width: 100%; height:100%;”>
<!– Note: this shows a few designer errors but works–>
<div style=”background:{{value}};“> </div>
</div>
</template>- Set the background not the background-color;
- Set the div content to be as an empty div content doesn’t display anything.
Again, thanks for the excellent support.
xyzzyMemberDon’t need row templates. I have tried using a column template but there doesn’t appear to be anyway to inject the {{value}} into the background-color attribute of the div – and that is what I need. value has the format #FFFFFF
This is fine if the background-color is fixed at compile time as per all of the examples:
<div style=”padding: 4px; background-color: #AABBCC; “>{{value}}</div>
I need to inject the {{value}} into the background-color (replacing the hard-coded #AABBCC). This throws a compile error:
<div style=”padding: 4px; background-color: {{value}}; “></div>
If you believe this is possible then please post the code.
I have tried attribute splatting but this only moves the problem into how do I inject the {{value}} into the function parameter.xyzzyMemberThanks aconley for the suggestion. It didn’t work but it did make me look at the method list more closely (I tried Refresh(), RefreshState() and RefreshView() along the way) and there is an AddRow() method there that worked a treat.
Looks like the DataSource only does the initial population and any changes to the underlying LIST<> has no subsequent effect after initialisation – tried new-ing the list and adding to it with no effect on the grid rows. Seems counter-intuitive but the LIST<> appears to be a once only bound.
cdfGrid1.AddRow(new
{
illuminant = cdf.illuminant,
…
status = cdf.status,
HunterLab = cdf.HunterLab
});
xyzzyMemberHi,
I’m having a similar issue and probably doing something stupid but whatever I do the grid always shows “No rows” and doesn’t issue any errors. My code follows the pattern above – I’ve tried using my own “Thing” object and a generic object but with no difference. My grid is initial empty on start up, and gets populated as the output of user initiated process.
<Grid @ref=”cdfGrid1″ DataSource=”dsColourDifference” Appearance=@appearance>
<Columns>
<Column DataField=”illuminant” Label=”Illuminant”></Column>
…
<Column Visible=@HunterLab DataField=”HunterLab” Label=”HunterLab”></Column>
<Column DataField=”Status” Label=”Status”></Column>
</Columns>
</Grid>
private List<object> dsColourDifference = new List<object>();
private Grid cdfGrid1;
dsColourDifference = new List<object>() {
new {
illuminant = cdf.illuminant,
…
status =cdf.status,
HunterLab = cdf.HunterLab
}
};
}
cdfGrid1.StateHasChanged();
Just to re-iterate: I also tried using an object (say “Thing”) with the listed properties, get and set, and using “new Thing {” instead of “new {” without any difference.
xyzzyMemberThanks. For others looking at this post the solution is:
private void cboFormula_Change(Event eventObj)
{
MultiComboInputChangeEventDetail detail = eventObj[“Detail”];
if (detail.Value != detail.OldValue) //Redundant as fires when an item is clicked or unclicked therefore always a change
{
string csv = detail.Value;
csv = csv.Replace(” “, “”); //The returned array is 0, 1, 4, 6 – so has a space after each comma
var items = csv.Split(‘,’)
.Where(m => int.TryParse(m, out _))
.Select(m => int.Parse(m))
.ToList();
myBooleanSetting = items.Contains(0);
…. (repeat for each item)
}
}
You get four properties in the event object:
Value – CSV string of integer values (post-change)
OldValue – CSV string of integer values (pre-change)
And similar with the text strings of the items: Label and OldLabel
If you have a long list best option is to compare the OldValue and Value to see what changed.xyzzyMemberHi,
Let’s try that again…
There’s not much documentation on using the ScrollBar in Blazor.
I need vertical and horizontal scroll bars around a div that scrolls the contents of the div. How do I achieve this (code below)?</div>
<ScrollBar Orientation=”Horizontal” Id=”horizontal” Style=”width:100%; position:inherit; bottom:0px;” OnChange=@Horizontal_Change></ScrollBar>
<ScrollBar Orientation=”Vertical” Id=”vertical” Style=”height:100%; position:inherit; right:0px;” OnChange=@Vertical_Change></ScrollBar>
<div id=”scrollableContainer”>
<BECanvas Width=@CanvasWidth Height=@CanvasHeight @ref=”CanvasRef”></BECanvas>
</div>
The scroll bars are there, but moving the scroll bar has no effect.
How do I pick up the scroll offset in the event handlers and apply it to the div? The following throws an exception:
void Horizontal_Change(Event eventObj)
{
string offset = eventObj[“Detail”].Value.ToString();
}
Finally, could you add a method to Hide a toolbar instead of just Disabled?
ThanksxyzzyMemberSorry, you can close this – not a bug.
There is an onclick event attached to the BECanvas (attached using JSInterop) that fires a C# method that closes the modal window. When resizing the window smaller the onclick event on the BECanvas is firing when I was not expecting it to as I’m not clicking on it. I’ve attached OnResizeStart and OnResizeEnd events to the Window object to switch a flag on and off that the BECanvas onclick event checks (to ensure window is not being resized) before closing the modal window.xyzzyMember<div id=”canvasHolder” style=”position: fixed; width: 100%; height: 100%; left: 0; cursor: @cursor;”>
<BECanvas Width=@CanvasWidth Height=@CanvasHeight @ref=”CanvasRef”></BECanvas>
<Window OnClose=@OnOneBiggyCanvasClicked Label=”Single Sample” HeaderButtons=@HeaderButtonsOneBiggy ResizeMode=”WindowResizeMode.Both” IsOpened=@OneBiggyOpen Style=”position:center; width:400px; height:400px;” Modal=”false”>
<div id=”canvasHolderOneBiggy” style=”z-index:1000; position: fixed; width: 100%; height: 100%; left: 0px; top:40px;”>
<BECanvas Width=@OneBiggyWidth Height=”@OneBiggyWidth” @ref=”CanvasOneBiggyRef”></BECanvas>
</div>
</Window>
</div>xyzzyMemberHi,
Sent a video of this effect in response to your email. Does it every time.
This is a window object with a BECanvas object in it. Window is launched from a click event on another BECanvas object.
[caption id="" align="alignnone" width="1639"] code[/caption]
NevillexyzzyMember
Ok, figured that out too:
ComboBoxChangeEventDetail detail = eventObj[“Detail”];
xyzzyMemberOk, figured this out – the typing needs to be a bit less…
@if (cboGamma == null)
{
cboGamma = new List<object>()
{
new {label = “L*”, value = “0”},
new {label = “sRGB”, value = “1”},
new {label = “V”, value = “2”}
};
}
List<object> cboGamma;
How do I detect the OnChange event event properties? I have:
<ComboBox DataSource=”@cboGamma” OnChange=@cboGamma_Change DisplayMember=”label” ValueMember=”value” C Style=”margin-left: 5px; width: 80px”></ComboBox>
@code{
private void cboGamma_Change(Event eventObj)
{
ComboBoxItemClickEventDetail detail = eventObj[“Detail”];
string label = detail.Label;
int value = detail.Value;
}
But the eventObj[“Detail”] throws an error. How do I get the Label and Value?
-
AuthorPosts